Closed chejinge closed 2 weeks ago
A new feature to retrieve multiple key-value pairs with associated TTL (time-to-live) information has been added to both Storage
and Redis
classes. This update involves introducing the MGetWithTTL
function for fetching values along with their expiration times. Additionally, other helper methods for clearing values, calculating TTL, and handling parsed string values have been introduced to support this functionality.
File | Summary |
---|---|
src/storage/include/storage/storage.h |
Added Status MGetWithTTL(const Slice& key, std::string* value, int64_t* ttl); in Storage class. |
src/storage/src/redis.h |
Added MGetWithTTL method to the Redis class for retrieving multiple values with TTL information. |
src/storage/src/storage.cc |
Implemented the MGetWithTTL method in the Storage class for multi-key retrieval with TTL. |
src/storage/src/redis_strings.cc |
Added the MGetWithTTL method and other helper functions for TTL calculations and value handling in Redis class. |
sequenceDiagram
participant Client
participant Redis
participant Storage
Client->>Redis: MGetWithTTL(key, value*, ttl*)
Redis->>Storage: MGetWithTTL(key, value*, ttl*)
Storage-->>Redis: value, ttl
Redis-->>Client: value, ttl
In the fields where data grows, A new function gracefully flows. Retrieving keys with time in tow, To see when each is set to go. With
MGetWithTTL
our code now knows, The life of keys, like wind that blows. 🐇📦⏰🌿
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
写mgetwithttl这个函数的目的是: 当mget多个key,其中有一些key不是string类型的时候,返回nil而不是返回 错误,这里跟redis保持一致了
Summary by CodeRabbit
New Features
Enhancements
GetWithTTL
method to better handle value retrieval and TTL calculation.