File size: 484 Bytes
aac350d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""Cache service — inspection + invalidation."""

from __future__ import annotations

from storage.cache import Cache


class CacheService:
    """Read-mostly cache facade."""

    def __init__(self, cache: Cache) -> None:
        self._cache = cache

    def stats(self) -> dict:
        return self._cache.stats()

    def invalidate(self, key: str) -> bool:
        return self._cache.invalidate(key)

    def clear(self) -> int:
        n = self._cache.clear()
        return n