Skip to main content

.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: escondite-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 a8cd25d8c2ab03e1d41019f463de666ad7757adeb4b5602aa84c34c51fca715e
MD5 df8bc89b23fdc966878ab3d0ccd34d91
BLAKE2b-256 9a6ceb27f99df5c0ac9c5458c0e5866a6114ea257c4d586d1cd505cbab3f2c09

See more details on using hashes here.

File details

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

File metadata

  • Download URL: escondite-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0bd2331d24555268879fc35d9ed557b7cc06a654b54a4f8eee26edcd8cb6f568
MD5 9899191f7850348900dac191a4a876c9
BLAKE2b-256 ee0b1030a02dc7a616ead002f2f0308cd2e03c46307d73ec2f8afd7a5e713d02

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