tessl install tessl/pypi-frozendict@2.4.0A simple immutable dictionary implementation with hashing support and performance optimizations
Agent Success
Agent success rate when using this tile
85%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.31x
Baseline
Agent success rate without this tile
65%
Build a simple configuration cache system that stores and retrieves configuration snapshots. The system should use configurations as lookup keys and track unique configurations efficiently.
Store configuration dictionaries and retrieve their associated metadata using the configuration as a lookup key.
Verify whether a configuration has been stored previously.
Count and retrieve all unique configurations stored in the cache.
The system should handle nested dictionaries and treat all configurations as immutable snapshots. Configurations can contain strings, numbers, booleans, and nested dictionaries.
@generates
class ConfigCache:
"""A cache system for storing and retrieving configuration snapshots."""
def __init__(self):
"""Initialize the configuration cache."""
pass
def store_config(self, config: dict, timestamp: str) -> None:
"""
Store a configuration snapshot with its timestamp.
Args:
config: Configuration dictionary (may be nested)
timestamp: Timestamp string associated with this configuration
"""
pass
def get_timestamp(self, config: dict) -> str | None:
"""
Retrieve the timestamp for a given configuration.
Args:
config: Configuration dictionary to look up
Returns:
The associated timestamp string, or None if not found
"""
pass
def has_config(self, config: dict) -> bool:
"""
Check if a configuration has been stored.
Args:
config: Configuration dictionary to check
Returns:
True if the configuration exists in the cache, False otherwise
"""
pass
def count_unique(self) -> int:
"""
Get the count of unique configurations stored.
Returns:
Number of unique configurations in the cache
"""
pass
def get_all_configs(self) -> set:
"""
Get all unique configurations as a set.
Returns:
Set containing all stored configurations
"""
passProvides immutable dictionary support with hashability for use as dictionary keys and in sets.
@satisfied-by