Skip to main content

Simple and fast Python in-memory caching library

Project description


Build Status Codecov Checked with mypy Code style: black

Simple and fast Python in-memory caching with support for TTLs.

Meant to speed up using dictionaries as cache backend for simple usecases.

No external dependencies, 100% code coverage and static type checked.


Requires Python 3.6+.

pip install poche



  • <input type="checkbox" checked="" disabled="" /> Basic TTL
  • <input type="checkbox" checked="" disabled="" /> get
  • <input type="checkbox" checked="" disabled="" /> set
  • <input type="checkbox" checked="" disabled="" /> getset
  • <input type="checkbox" checked="" disabled="" /> flush


  • <input type="checkbox" disabled="" /> expire
  • <input type="checkbox" disabled="" /> persist
  • <input type="checkbox" disabled="" /> rename


  • <input type="checkbox" disabled="" /> getorset with callback


from time import sleep

import poche

>>> c = poche.Cache()

>>> c.set("one", "uno")
>>> c.get("one")

>>> c.get("two")
>>> c.getset("two", "dos")
>>> c.get("two")

>>> c.set("three", "tres", ttl=2)
>>> c.get("three")
>>> sleep(2)
>>> c.get("three")

>>> c = poche.Cache(ttl=2)  # you can also define a default TTL

>>> c.set("four", "cuatro")
>>> c.get("four")
>>> sleep(2)
>>> c.get("four")

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for poche, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size poche-1.0.0-py3-none-any.whl (16.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size poche-1.0.0.tar.gz (15.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page