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.1.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.1-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: escondite-0.1.1.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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.1.tar.gz
Algorithm Hash digest
SHA256 52e8568e201986991e222b5c448f6c4f1d1c9a1a4509ca9b105f299ce45baf38
MD5 71b5c22a23ff0247619490b2d72ca537
BLAKE2b-256 bd34e2bc18f6aeafb875ebf1b5bb741810cc179220f1001ada27b2534d7b24cd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: escondite-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bbca9b112dcfd068f3a97736abcea323988aa3cea7f3f97289df7758c1090153
MD5 79b3fa5b8bd580f2072123b12a7cbf60
BLAKE2b-256 9cf727d7beab09cedffc1e47824bfd9bff61537625bb135f82793d76b444c37b

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