jeudi 19 mars 2015

How to store data in memory(RAM) using php without using Memcache/Redis or any other software?


I want implement a cache system in PHP consisting of following features


1) It should be able to store any(large or small) amount of data as long as the memory serves.(key value pair i.e. get & set)


2) It should have TTL


3) It should have LRU


4) Complexity should be O(1)


Constraints: 1) I am not allowed to use any middleware i.e. memcache or redis or any other in memory DB - so essentially implement memcache


Now problem here is



  1. How can I interact with RAM using php?

  2. PHP variables can be stored in memory but as soon as thread ends all variables are garbage collected. So you loose data?

  3. May be use in memory mysql db engine? Can I?

  4. Is it even possible to build such system using PHP?

  5. What are my options?





Aucun commentaire:

Enregistrer un commentaire