-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Milestone
Description
NOTIF_UPD-5: Develop 'next-updates-cache' Library for Managing User Updates
Description
Create the 'next-updates-cache' library for handling temporary storage and retrieval of updates related to user activities in the app. This library will interact with the cache system to store updates scoped by the user's accountId, ensuring efficient access to relevant updates for each user.
Key Methods and Implementation
-
setUpdate:
- Purpose: Store an update in the cache, associated with a specific user.
- Parameters:
accountId(UUID),updateType(enum),updateContent(JSONB). - Functionality: Constructs a cache key using the
accountIdandupdateType. Stores theupdateContentin the cache under this key. - Type Safety: Ensures that
updateTypeandupdateContentare validated against predefined types.
-
getUpdates:
- Purpose: Retrieve all updates for a specific user.
- Parameters:
accountId(UUID). - Functionality: Fetches all updates from the cache that are associated with the given
accountId. - Returns: An array of update objects, each containing
updateTypeandupdateContent.
-
clearUpdate:
- Purpose: Remove a specific update from the cache.
- Parameters:
accountId(UUID),updateType(enum). - Functionality: Constructs the cache key and removes the corresponding update from the cache.
-
clearAllUpdates:
- Purpose: Remove all updates for a specific user.
- Parameters:
accountId(UUID). - Functionality: Identifies and clears all updates associated with the
accountId.
-
initializeCache:
- Purpose: Initial setup or reset of the cache for updates.
- Functionality: Ensures the cache is in a valid state to start storing updates. This might include clearing old data or setting up necessary structures in the cache.
Acceptance Criteria
- Efficient Update Management: The library should efficiently handle the storage, retrieval, and deletion of updates in the cache.
- User Scope: Updates are correctly scoped to individual users based on
accountId. - Type Safety: Ensures that the updates are handled in a type-safe manner, aligning with the defined update types and structures.
- Performance: The library should perform well even with a large number of updates and users.
- Testing and Documentation: Comprehensive testing to ensure reliability, along with detailed documentation on how to use the library.
Notes
- Focus on creating a scalable and efficient caching strategy that can handle a high volume of updates.
- Consider the expiration policy for updates in the cache to ensure they are cleared when no longer needed.
- Ensure the library integrates smoothly with the existing cache setup and aligns with the overall architecture of the app.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status