Skip to main content

weaklru

Simple combination of a weakref cache and a lru cache.


class Obj:
  pass


l = WeakLRU(max_size=2)

l.set("a", Obj())
l.set("b", Obj())
l.set("c", Obj())
l.get(a)        # none
l.get(b)        # obj
l.get(c)        # obj

You can add objects to the cache, and they will never expire as long as they are being used.

Also, a maximum number of objects will be stored in the LRU portion of the cache.

Metadata

Release files for weaklru 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for weaklru 0.1.1
File Size Uploaded
weaklru-0.1.1.tar.gz 2.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for weaklru 0.1.1
File Interpreter ABI Platform
weaklru-0.1.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 6.3 kB

Release files / weaklru-0.1.1.tar.gz

Download URL weaklru-0.1.1.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7aac7504b2023087d95908502785be4aebc294a132cf28d2b4660cfc066f6b64
BLAKE2b-256 checksum
How to use checksums
c31b89dac84b14d425e9fc3d4866f9e2f63a4dade92a9dc2a9f7e9417a570f4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.6.8 Windows/10

Release files / weaklru-0.1.1-py2.py3-none-any.whl

Download URL weaklru-0.1.1-py2.py3-none-any.whl
Size 3.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
3c1a2d0e7170b0c69bc00805cc43a61eb949b240f70ecb157f41585006908fd9
BLAKE2b-256 checksum
How to use checksums
01c464dbc884946232caa65c456331955f406a4524f00861c645908528574134
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.6.8 Windows/10

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page