Skip to content

Add a Redis core #273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 7, 2025
Merged

Add a Redis core #273

merged 6 commits into from
Jul 7, 2025

Conversation

shaypal5
Copy link
Member

@shaypal5 shaypal5 commented Jul 5, 2025

No description provided.

@shaypal5 shaypal5 marked this pull request as ready for review July 5, 2025 22:24
@shaypal5 shaypal5 requested review from Borda and Copilot July 5, 2025 22:24
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds Redis-based caching support to Cachier, introducing a new Redis core implementation, accompanying tests, documentation updates, and CI integration.

  • Implements _RedisCore in src/cachier/cores/redis.py and wires it into the cachier decorator.
  • Adds comprehensive tests for the Redis core under tests/test_redis_core.py and CI config for Redis.
  • Updates type definitions, examples, README, and CI workflows to support the new Redis backend.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/cachier/cores/redis.py New Redis core implementation for caching logic
src/cachier/core.py Registers redis_client param and redis backend
src/cachier/_types.py Extends Backend and defines RedisClient type
tests/test_redis_core.py Tests covering Redis core features
tests/redis_requirements.txt Test dependencies for Redis (redis, pandas, birch)
examples/redis_example.py Example usage of the Redis backend
README.rst Documentation section for Redis core
.github/workflows/ci-test.yml CI pipeline steps and matrix for Redis tests
Comments suppressed due to low confidence (3)

src/cachier/cores/redis.py:208

  • There are no tests covering clear_being_calculated; consider adding a test in tests/test_redis_core.py to ensure entries marked as being calculated are correctly reset.
    def clear_being_calculated(self) -> None:

src/cachier/core.py:109

  • The decorator signature does not include a key_prefix parameter, so passing key_prefix to the Redis backend (as shown in the README) will cause an unexpected argument error. Consider adding key_prefix to the decorator parameters and passing it to _RedisCore.
def cachier(

examples/redis_example.py:57

  • [nitpick] Calling setup_redis_client() directly may return None and cause a MissingRedisClient error. It’s better to pass the callable or guard the decorator application to ensure a valid client is provided.
    @cachier(backend="redis", redis_client=setup_redis_client())

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@shaypal5 shaypal5 merged commit e9db66d into master Jul 7, 2025
42 checks passed
@shaypal5 shaypal5 deleted the redis branch July 7, 2025 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant