Skip to content

Implement localKeys and localSize in RedisCache #4093

Open

Description

@coderabbitai

Description

The RedisCache class currently throws UnimplementedError for the localKeys getter and localSize getter, which are part of the GlobalCache interface. These methods need to be properly implemented to complete the cache interface.

Affected Files

  • packages/serverpod/lib/src/cache/redis_cache.dart:87
  • packages/serverpod/lib/src/cache/redis_cache.dart:92

Context

@override
// TODO: implement localKeys
List<String> get localKeys =>
    throw UnimplementedError('No local keys are used in RedisCache');

@override
// TODO: implement localSize
int get localSize =>
    throw UnimplementedError('No local keys are used in RedisCache');

Suggested Implementation

  • Research whether Redis-based caches should track local keys or if these methods should return empty/zero values
  • Implement the methods according to the intended cache semantics
  • Add tests to verify the implementation

Impact

API completeness, prevents runtime errors when these methods are called

Related

Metadata

Metadata

Assignees

Labels

area: cacheenhancement

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions