"""
Cache types and enums.
"""
from enum import Enum
from dataclasses import dataclass


class CacheStrategy(str, Enum):
    """Cache eviction strategies"""
    TTL = "ttl"  # Time To Live
    LRU = "lru"  # Least Recently Used
    LFU = "lfu"  # Least Frequently Used


@dataclass
class CacheStats:
    """Cache statistics"""
    hits: int = 0
    misses: int = 0
    sets: int = 0
    deletes: int = 0
    evictions: int = 0

    @property
    def hit_rate(self) -> float:
        """Calculate cache hit rate"""
        total = self.hits + self.misses
        return self.hits / total if total > 0 else 0.0
