Skip to content

NOTIF_UPD-5: Develop 'next-updates-cache' Library for Managing User Updates #251

@sebpalluel

Description

@sebpalluel

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

  1. 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 accountId and updateType. Stores the updateContent in the cache under this key.
    • Type Safety: Ensures that updateType and updateContent are validated against predefined types.
  2. 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 updateType and updateContent.
  3. 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.
  4. clearAllUpdates:

    • Purpose: Remove all updates for a specific user.
    • Parameters: accountId (UUID).
    • Functionality: Identifies and clears all updates associated with the accountId.
  5. 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

  1. Efficient Update Management: The library should efficiently handle the storage, retrieval, and deletion of updates in the cache.
  2. User Scope: Updates are correctly scoped to individual users based on accountId.
  3. Type Safety: Ensures that the updates are handled in a type-safe manner, aligning with the defined update types and structures.
  4. Performance: The library should perform well even with a large number of updates and users.
  5. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions