Skip to main content

Store objects in caches at startup time.

Project description

Escondite

Escondite is a simple caching library for Python that allows you to store and retrieve data with string keys. Escondite is used by the Bolinette project to cache classes at script load time.

Installation

$ pip install escondite  # or use your preferred package manager

Usage

Escondite provides a Cache class that can be used as a singleton or instantiated as needed. You can also use the default user cache instance __user_cache__ to store everything in a single global cache.

from collections.abc import Callable
from escondite import Cache, __user_cache__

def cache_class[**P, T](cls: Callable[P, T], *, cache: Cache | None = None) -> Callable[P, T]:
    Cache.with_fallback(cache).add('stored_classes', cls)
    return cls

@cache_class
class MyClass:
    pass

assert 'stored_classes' in __user_cache__
assert __user_cache__.get('stored_classes') == {MyClass}

In this example, the cache_class decorator adds the decorated class to the cache under the key 'stored_classes'. If the cache funtion is called without a specific cache, it uses the global __user_cache__ instance with the with_fallback method.

Project details


Download files

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

Source Distribution

escondite-0.1.2.tar.gz (2.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

escondite-0.1.2-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file escondite-0.1.2.tar.gz.

File metadata

  • Download URL: escondite-0.1.2.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for escondite-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a567e096b7c25343bb7890b41521668fdbe3fdd76509d9ce2047c1f87d05056d
MD5 526900fd7506b28ff3f20eb8ca8d77d7
BLAKE2b-256 a9f3907a17de810dd3047e93fd699675422e9d00d2db266b2a409301f1a05f53

See more details on using hashes here.

File details

Details for the file escondite-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: escondite-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for escondite-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 db0427fd0628874c800b4164333d342a65ad52a0ea006e2387f84755f2fcf0a7
MD5 5959e7dfa68600f36eda8b1bf455f5bd
BLAKE2b-256 34f1abeee0105c33d8f3ad1792baae8d8016211c1dceb317a7723f37c734c37c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page