Skip to main content

Provides cache utils

Project description

Classic Cache

Classic Cache - предоставляет функциональность кеширования. Предоставляет утилиты для пометки кеша, бекенд для кеширования в RAM и бекенд для кешироавния в Redis.

Установка

Для установки Classic-Cache вы можете использовать pip:

pip install classic-cache

Для установки Classic-Cache с поддержкой Redis:

pip install classic-cache[redis]

Использование

from classic.cache import cached, InMemoryCache, RedisCache
from classic.components import component

@component
class SomeClass:

    # Кэширование результата метода some_method на 60 секунд
    @cached(ttl=60)
    def some_method(self, arg1: int, arg2: int) -> int:
        return arg1 + arg2

# кеширование в памяти
cache = InMemoryCache()
# ИЛИ
# кеширование в Redis
cache = RedisCache(connection=Redis())

some_instance = SomeClass(cache=cache)

# ручная инвалидация кэша
some_instance.some_method.invalidate(1, 2)
# ручное обновление кэша
some_instance.some_method.refresh(1, 2)

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

classic_cache-1.2.1.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

classic_cache-1.2.1-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file classic_cache-1.2.1.tar.gz.

File metadata

  • Download URL: classic_cache-1.2.1.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for classic_cache-1.2.1.tar.gz
Algorithm Hash digest
SHA256 eb98f5cbe4b7f2c2d235ee3006b9aba8f73f1bf51fdc4436ef557510fbcb8cc9
MD5 4415298cefc44edc2e1a45c307dd9cc7
BLAKE2b-256 a6b43a4d7994148823c8e4fe324ca4758fcbcfbf4f1a7993c0868c7755022a49

See more details on using hashes here.

Provenance

The following attestation bundles were made for classic_cache-1.2.1.tar.gz:

Publisher: publish.yml on variasov/classic-cache

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file classic_cache-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: classic_cache-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for classic_cache-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 62e1bdc8666eaa5c8fc9288a63ac6f2b3e1322164a1ca1a6c3ae7a9c1c9b9b7c
MD5 34aee9282f64e922175f7c4901926170
BLAKE2b-256 5c3d80af1a09ec55cb63601fa36ffe82aba13af11130a49b2dc5bb848b2c846d

See more details on using hashes here.

Provenance

The following attestation bundles were made for classic_cache-1.2.1-py3-none-any.whl:

Publisher: publish.yml on variasov/classic-cache

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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