Skip to content
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

feat: Redis Cache Implementation #1279

Merged
merged 11 commits into from
Dec 21, 2024
Merged

feat: Redis Cache Implementation #1279

merged 11 commits into from
Dec 21, 2024

Conversation

shakkernerd
Copy link
Member

Relates to: #1277

This PR introduces a Redis cache implementation. The implementation provides a reusable and scalable solution for caching data in the application by also implementing the IDatabaseCacheAdapter interface.

Implemented Features:

  • getCache: Retrieves cached data for a given agentId and key.
  • setCache: Caches data with a unique key constructed using agentId and key.
  • deleteCache: Removes cached data for the specified agentId and key.
  • Proper error handling and logging for all Redis operations.
  • Integration with the IDatabaseCacheAdapter interface.

Code Highlights:

  • A new RedisClient class implements the IDatabaseCacheAdapter interface.
  • The buildKey method ensures unique Redis keys for each agent and operation.
  • ioredis is used for efficient Redis interactions, supporting advanced Redis features like clusters and pipelines if needed in the future.

Benefits:

  • Provides a scalable and reusable caching solution.
  • Ensures clear separation of concerns and adheres to the existing interface.
  • Improves application performance by reducing redundant data retrieval operations.

Testing
The implementation has been tested for the following scenarios:

  • Successfully setting a cache entry.
  • Retrieving a cache entry that exists.
  • Retrieving a cache entry that does not exist.
  • Deleting a cache entry.
  • Handling Redis errors gracefully during operations.

Copy link
Contributor

@twilwa twilwa left a comment

Choose a reason for hiding this comment

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

lgtm, still pushin 3h for review baby yeeea

lockfile check is failing bc lockfile check needs a fix afaik:

looks like wehave some failures on the frozen-lockfile smoke test?
& some changes to package.json & pnpm-lock
ShakkerNerd — Today at 4:33 PM
On 1279? Its the pnpm lock file error
yikesawjeez — Today at 4:33 PM
yeah not up to speed with what the issue there is; you confident that we're good to shove through anyway?
ShakkerNerd — Today at 4:34 PM
I dont see any issue other than it should be approved and be out

@shakkernerd shakkernerd merged commit e0c72a4 into develop Dec 21, 2024
2 of 4 checks passed
@shakkernerd shakkernerd deleted the feat/redis_adapter branch December 21, 2024 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants