atlassian-labs / react-resource-router

Configuration driven routing solution for React SPAs that manages route matching, data fetching and progressive rendering
https://atlassian-labs.github.io/react-resource-router
Apache License 2.0
202 stars 28 forks source link

Implemented LRU Cache - Removing the least recently used resource #87

Closed prithveeshgoel closed 3 years ago

prithveeshgoel commented 3 years ago

In this implementation there is an addition of LRU cache in the Resource caching. When a resource of a type has maxAge set and has multiple keys associated with it, in that case there would be multiple resources with different keys which would be cached in the store. This could lead to heavy memory consumption on the browser. In order to have a check, maxCache has been added. When a particular resource type is given a maxCache value, then it will restrict the caching of resources to that number. Once the cache is full, then whenever a new resource is requested, it will delete the least recently used resource and make space for the new resource.

atlassian-cla-bot[bot] commented 3 years ago

Hooray! All contributors have signed the CLA.