Mahmoud Abd AL Kareem
Mahmoud Abd AL Kareem

Reputation: 645

Caching In Laravel5.2

I want to use Redis as cache in my project, so as we know that redis store data in the memory, absolutely there are limitations on that, how long the data will persist on memory ? Do I want to implement some algorithms in that(least recently used for example) ?

Upvotes: 0

Views: 86

Answers (1)

Karthikeyan Gopall
Karthikeyan Gopall

Reputation: 5689

  • There is no need of implementing algorithms explicitly. Redis comes with built in eviction policies. You can configure one of them. http://redis.io/topics/lru-cache
  • Redis support expiring keys after a certain time range. Suppose you need the cache only for 4 hours you can implement this. http://redis.io/commands/expire
  • Redis does compression for data within a range. You can implement all you hashes, sorted sets in such a way that it can hold a lot of data in a lesser memory space. http://redis.io/topics/memory-optimization
  • Go through all these docs, you will get a better idea on implementing. Hope this helps.

Upvotes: 1

Related Questions