Showing posts with label LRU. Show all posts
Showing posts with label LRU. Show all posts

November 24, 2019

#Algorithms Part 4: Caching Algorithms in Java (LRU and LFU)

What is Cache?
  • As its expensive to every-time fetch data from the main storage, we story it in temporary location from where it can be retrieved faster. This temporary location is called Cache.
  • A Cache is made of pool of entries and these entries are a copy of real data which are in storage and it is tagged with a tag (key identifier) value for retrieval.
  • When an application receives a request to get a particular information, it is first checked in cache. If an entry is found with a tag matching with the request, it will be returned. Else it will be fetched from the main storage, kept in Cache and then returned to the client.