spakky-cache¶
애플리케이션 데이터 캐시 계약과 AOP 어노테이션입니다.
어노테이션¶
Cache method annotations.
Cacheable(key=None, ttl=None, tags=())
dataclass
¶
Bases: FunctionAnnotation
Annotation for caching method return values.
CacheEvict(key=None, tags=())
dataclass
¶
Bases: FunctionAnnotation
Annotation for evicting a cache entry after successful method execution.
cacheable(key=None, *, ttl=None, tags=())
¶
Decorate a method so its return value is cached by AOP.
Source code in core/spakky-cache/src/spakky/cache/annotation.py
cache_evict(key=None, *, tags=())
¶
Decorate a method so its cache entry is evicted after success.
Source code in core/spakky-cache/src/spakky/cache/annotation.py
AOP Aspect¶
AOP aspects for cache annotations.
CacheAspect(cache)
¶
결과 계약¶
캐시 인터페이스¶
Backend-neutral cache contract.
CacheTTL = float | int | timedelta | None
¶
Cache entry lifetime. None means no automatic expiry.
ICache
¶
Bases: ABC
Backend-neutral application data cache contract.
ITaggedCache
¶
Bases: ICache[T], ABC
Cache backend that can index and evict entries by tag.
IStampedeProtectedCache
¶
Bases: ICache[T], ABC
Cache backend that serializes concurrent miss population.
get_or_set(key, factory, *, ttl=None, tags=())
abstractmethod
¶
Return cached value or populate it once through a backend lock.
Source code in core/spakky-cache/src/spakky/cache/interfaces/cache.py
get_or_set_async(key, factory, *, ttl=None, tags=())
abstractmethod
async
¶
Async variant of get_or_set.
Source code in core/spakky-cache/src/spakky/cache/interfaces/cache.py
IWritePolicyCache
¶
Bases: ICache[T], ABC
Cache backend that coordinates cache writes with an origin writer.
write_through(key, value, writer, *, ttl=None, tags=())
abstractmethod
¶
Write to the origin first, then update the cache.
Source code in core/spakky-cache/src/spakky/cache/interfaces/cache.py
write_behind(key, value, writer, *, ttl=None, tags=())
abstractmethod
¶
Update the cache first, then invoke the origin writer.
Source code in core/spakky-cache/src/spakky/cache/interfaces/cache.py
write_through_async(key, value, writer, *, ttl=None, tags=())
abstractmethod
async
¶
Async variant of write_through.
Source code in core/spakky-cache/src/spakky/cache/interfaces/cache.py
write_behind_async(key, value, writer, *, ttl=None, tags=())
abstractmethod
async
¶
Async variant of write_behind.
Source code in core/spakky-cache/src/spakky/cache/interfaces/cache.py
플러그인 진입점¶
Plugin initialization entry point.
initialize(app)
¶
Initialize the spakky-cache plugin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
SpakkyApplication
|
The SpakkyApplication instance. |
required |