CHANGELOG#
Changelog#
v0.7.0#
π 2026-03-30
π Breaking Changes:
Constructor parameter rename: the Redis client parameters have been renamed to
clientandfactory(keyword-only).factoryis preferred for concurrent/production usage.Policy must be an instance: the
policyargument toRedisFuncCachenow requires a pre-instantiatedAbstractPolicyinstance (e.g.LruTPolicy()), previously callers might have passed the policy class.Passing a callable as the
clientpositional argument is deprecated. Usefactory=instead. The library will emit aDeprecationWarningwhen detecting the old pattern.
Migration example:
# OLD cache = RedisFuncCache("my-cache", LruTPolicy, client=redis_client) # NEW (v0.7+) cache = RedisFuncCache("my-cache", LruTPolicy(), factory=lambda: redis.from_pool(redis.ConnectionPool(...)))
π Notes:
The change to require policy instances was made to ensure policy objects can be bound to the cache (policies hold cache-specific state). Reuse of the same policy instance across multiple caches is discouraged; create a new policy object per cache if independent state is required.
Please update any code that relied on passing policy classes or that passed a callable as the
clientpositional argument. If you want, I can scan the repository for remaining occurrences and update examples/tests accordingly.
v0.6.0#
π Breaking Changes:
Drop support for Python 3.8
Upgrade build backend to
setuptools>=80
π Improvements:
Optimized cache eviction logic in Lua scripts to improve performance and correctness
Fixed issues with evicted keys handling in LRU cache implementation
Improved consistency in cache TTL handling across all cache policies
Simplified and unified code structure in all put scripts for better maintainability
Enhanced efficiency by replacing loops with batch operations in FIFO_T policy
π Bug Fixes:
Fixed LRU cache score update logic that could cause incorrect eviction order
Corrected cache access frequency update logic in LFU policy
Fixed timestamp update logic in LRU-T policy
Fixed wrong usages of table unpack in Lua scripts
π§Ή Chore:
Added Python 3.14 in CI and tests scripts
v0.5#
π 2025-08-26
β¨ New Features:
Added arguments excluding support for the
RedisFuncCacheclass, which makes it possible to cache functions with arguments that cannot be serialized.Added support for controlling cache TTL update behavior with
update_ttlparameter.Enhanced cache mode control with mode context managers:
RedisFuncCache.mode_context()for applying mode contextuallyRedisFuncCache.disable_rw()as an alias for completely disabling cache read and write operationsRedisFuncCache.read_only()for read-only cache modeRedisFuncCache.write_only()for write-only cache mode
Added new
RedisFuncCache.Statsclass for cache statistics, andRedisFuncCache.stats_context()for retrieving cache statistics in a context manager.Added support for per-invocationβs cache TTL(experimental).
Added
use_bytecodeattribute toHashConfigclass.
π Breaking Changes:
Rename
redis_func_cache.mixins.policiestoredis_func_cache.mixins.scripts.Remove
asynchronousproperty and related checks, you must ensure to decorate an async function with a cache instance has asynchronous redis client and a common function with a cache instance has synchronous redis client.
π Deprecated:
The property
RedisFuncCache.cacheis deprecated, useRedisFuncCache.get_cache()instead
π Improvements:
Optimized Lua scripts for better performance
Improved documentation and examples for cache mode control
Enhanced test coverage for new cache mode context managers
v0.4#
π 2025-06-24
β¨ New Features:
Added
bsonandyamlserializer/deserializer support for theRedisFuncCacheclass.Added comprehensive unit tests for exception handling, unserializable objects, various argument types, cache purge, custom serializers, and high concurrency scenarios (multi-thread/thread pool/concurrent exception handling).
π Breaking Changes:
The
serializeroptional parameter in theRedisFuncCacheβsdecorateand__call__methods has been replaced. It now accepts a tuple of(serializer, deserializer)or simply the name of the serializer function.
π Improvements:
Updated and optimized several Lua scripts to improve performance, reliability, and compatibility with Redis.
Refactored test code for better readability and maintainability.
Improved code style and type annotations across the codebase.
Improved Redis Lua script cleaning logic: now handles the absence of
pygmentsor Lua lexer more gracefully, and marks these branches as uncovered for coverage tools.
π¦ Packaging:
Added
bson,yamlas optional dependencies, andallfor all serializers.Added
types-all,types-PyYAML, andtypes-Pygmentsas optional dependencies for typing hints.Build and dependency management migrated to uv.
π Misc
Minor adjustments to documentation and configuration files.
v0.3#
π 2025-01-08
β¨ New Features:
Added setter methods for the
name,prefix,maxsize,ttl, andserializerproperties in theRedisFuncCacheclass.Introduced support for
msgpackandcloudpickle.Added βper-functionβ custom serializer/deserializer parameter to
RedisFuncCacheβs decorate method.
π Breaking Changes:
Moved the
lru-tpolicy class to thepolicies/lrumodule.Moved the
fifo-tpolicy class to thepolicies/fifomodule.Renamed
sizetoget_sizeandasizetoaget_sizeinAbstractPolicyand its subclasses.
πΉ Improvements:
The default hash function now calculates the hash value based on the callableβs byte code instead of source code.
Updated the default values of several arguments in the
RedisFuncCacheconstructor.Improved type casting in the
cachemodule.
π¦ Packaging:
Added
msgpackandcloudpickleas optional dependencies.Adjusted the
manifest.infile.
π§ͺ Tests:
Added more test cases.
Fixed asynchronous bugs in existing tests.
Optimized Docker Compose-based tests.
βοΈ CI:
Added Redis cluster tests in GitHub Actions.
Fixed issues with
codecovcoverage upload.Removed PyPy testing from
tests/run.sh.
v0.2.2#
π 2024-12-23
β¨ New Features:
New
fifo-t(Timestamp based pseudo FIFO replacement policy)
π Bug Fixes:
Wrong type checking for
redis.cluster.RedisClusterandredis.asyncio.cluster.RedisCluster
π Improvements:
Remove some un-used utilities
π¦ Packaging:
Add
hiredisextras requirementsAdjust
manifest.infile
π Documentation:
Modify documentation for docker-composed unit testing
π§ͺ Tests:
New add cluster based tests
Improved docker-composed based tests
v0.2.1#
π 2024-12-19
β¨ New Features:
Added support for asynchronous operations.
π Bug Fixes:
Resolved several known issues.
Eliminated duplicate parts in the function full name used as a key.
π Improvements:
Enhanced type hints for better code clarity.
Provided more detailed documentation to improve user understanding.
v0.1#
π 2024-12-17
The First release, itβs an early version, do not use it in production.