Skip to main content

Service caching API

Project description

slycache

PyPi version

Python versions

Build status

A caching API for python loosely modeled after the Java Caching API (JSR107).

Basic Usage

Start by registering a cache backend:

slycache.register_backend("default", my_cache_backend)

Define a key namespace:

# define a key namespace
user_cache = slycache.with_defaults(namespace="user")

Use the cache on methods and functions:

@user_cache.cache_result("{username}")
def get_user_by_username(username):
    ...

@user_cache.cache_result("{user_id}")
def get_user_by_id(user_id):
    ...

@user_cache.cache_put([
    "{user.username}", "{user.user_id}"
])
def save_user(user):
    ...

@user_cache.cache_remove([
    "{user.username}", "{user.user_id}"
])
def delete_user(user):
    ...

For more advanced usage see the documentation: https://snopoke.github.io/slycache/

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

slycache-0.3.1.tar.gz (53.8 kB view details)

Uploaded Source

Built Distribution

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

slycache-0.3.1-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file slycache-0.3.1.tar.gz.

File metadata

  • Download URL: slycache-0.3.1.tar.gz
  • Upload date:
  • Size: 53.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.18

File hashes

Hashes for slycache-0.3.1.tar.gz
Algorithm Hash digest
SHA256 a3ddc6bc0179b54b74ec13f0676c465f3d639278d37e3906f8606b11e5384104
MD5 0aa57a45e59bf6e647b65f0106690a69
BLAKE2b-256 f926531619f7551faace5257ab63b6d2a2ebc0b6cc6c5b7b7903abc09ef6f5e2

See more details on using hashes here.

File details

Details for the file slycache-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: slycache-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.18

File hashes

Hashes for slycache-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4175363f1640e46636026753884d539304b17f7d5bf0b7e3620156a5d442e3c9
MD5 0314e39a3af80dbe5954e42923a6e115
BLAKE2b-256 8027cf2a5d1aaeb81ec984ae492b44d8f5b82ca2361d3b1dc89a566d561d29a3

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