Skip to content

Refactor ObjectCacheStorage to use object_id for object storage#214

Open
yuki-uchida wants to merge 1 commit intonttcom:masterfrom
yuki-uchida:feature/objectid-cache-key
Open

Refactor ObjectCacheStorage to use object_id for object storage#214
yuki-uchida wants to merge 1 commit intonttcom:masterfrom
yuki-uchida:feature/objectid-cache-key

Conversation

@yuki-uchida
Copy link
Collaborator

This change modifies the ObjectCacheStorage to use object_id (and group_id where applicable) as the primary key for storing and retrieving objects in DatagramCache and SubgroupStreamCache, instead of an internally generated CacheId.

Key changes:

  • Modified DatagramCache to use (group_id, object_id) as the key for its TtlCache.
  • Modified SubgroupStreamCache to use object_id as the key for its TtlCache.
  • Removed the auto-incrementing CacheId mechanism from both cache types.
  • Updated get_next_object methods in both caches to find the next object based on object_id sequence rather than CacheId.
  • Adjusted ObjectCacheStorageCommand variants and the main object_cache_storage logic to reflect these changes in parameters and return types.
  • Updated ObjectCacheStorageWrapper and its call sites (primarily in datagram and subgroup stream forwarders) to align with the new API.
  • Added new unit tests for DatagramCache and SubgroupStreamCache to cover the new keying and retrieval logic, including tests for non-sequential object_ids.

This change modifies the ObjectCacheStorage to use `object_id` (and `group_id` where applicable) as the primary key for storing and retrieving objects in `DatagramCache` and `SubgroupStreamCache`, instead of an internally generated `CacheId`.

Key changes:
- Modified `DatagramCache` to use `(group_id, object_id)` as the key for its `TtlCache`.
- Modified `SubgroupStreamCache` to use `object_id` as the key for its `TtlCache`.
- Removed the auto-incrementing `CacheId` mechanism from both cache types.
- Updated `get_next_object` methods in both caches to find the next object based on `object_id` sequence rather than `CacheId`.
- Adjusted `ObjectCacheStorageCommand` variants and the main `object_cache_storage` logic to reflect these changes in parameters and return types.
- Updated `ObjectCacheStorageWrapper` and its call sites (primarily in datagram and subgroup stream forwarders) to align with the new API.
- Added new unit tests for `DatagramCache` and `SubgroupStreamCache` to cover the new keying and retrieval logic, including tests for non-sequential `object_id`s.
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.

1 participant