Skip to content

Cache-manager-snippet request #59

@SamparkBhol

Description

@SamparkBhol

Is your feature request related to a problem? Please describe.
many of us don't like the part of redundant database calls or API requests for the same data in my applications, which increases latency and puts unnecessary load on the server. Setting up efficient caching can be challenging, and I’m looking for a simple solution to optimize performance.

Describe the solution you'd like
I’d like to add a cache-manager.js utility that provides:

  • In-memory caching with a configurable Time-to-Live (TTL) for cached entries.
  • A simple get and set interface to make storing and retrieving data easy.
  • Cache statistics and monitoring to keep track of cache hits, misses, and memory usage.
  • Automatic cache invalidation to remove expired entries and optimize memory usage.
  • Memory usage optimization for managing large or frequently accessed datasets efficiently.

Describe alternatives you've considered

  • Redis: While it’s a robust option, it requires additional infrastructure, which can be overkill for smaller projects.
  • Local storage: This is limited to the browser and doesn’t support TTL or complex data storage needs.
  • Database caching: It’s reliable but slower than in-memory solutions and isn’t ideal for high-frequency data access.

Additional context
The utility would rely on node-cache to handle in-memory storage with expiration. I expect this feature to improve response times by 30-70% for cached data, reducing server load and enhancing performance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions