The thing is that the data is not static and might change depending on parameters so I would like to update it from time to time.
Memcached will be ideal for that!
The thing is that the data is not static and might change depending on parameters so I would like to update it from time to time.
Memcached will be ideal for that!
you might think so because you might not know the implementation details of caches. memcached takes the burden to manage the expiration settings from you. if you do it by yourself there is no need for a 3rd party cache. you just not only store the data value but also the expiration setting: cachedValue = {$key, $expiration, $value}. whenever you need your data your getter does an additional expiration check. if expired, it deletes the value from cache and returns NULL. in fact thats exactly what memcached and friends are doing, you just don't see it. do it on your own and you'r fine.
public function Cache::get($key) { // cache lookup $data = cache_fetch($key); if (!$data) // cache-miss return NULL; // cache-hit, data format: array(created, expires, value) $created = $data[0]; $expires = $data[1]; $value = $data[2]; // expiration checking if ($expires < time()) { cache_drop($key); return NULL; } return unserialize($value); }
for different values per parameters you store every data set under a different key.
regards
There are many reasons to use 3rd party stuff without implementing it by yourself.
Memcached is a distributed cache which can be accessed by multiple processes from multiple machines. There is no reason to try and implement this functionality if someone already did this for you and offers it for free.
If someone was able to use memcached in MQL4 I would love to know.
Thanks.
I understand why you are looking for such feature.
I would like a map (dictionary), associative array into MetaTrader but I didn't find a decent implementation.
http://en.wikipedia.org/wiki/Associative_array
http://en.wikipedia.org/wiki/Key-value_data_store
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Does anyone tried to use memcached for data caching?
I have indicators that take a long time to calculate and as long as I don't expect a value to change, I would like to take the value from cache.
I love memcahced, but I wasn't able to find a usable dll with exported functions.
Help will be strongly appreciated.
Thanks.
P.S.
Other caching solutions might be good as well.