Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter 2. Memcached. How do I get a list of keys?
#1

[eluser]zebric[/eluser]
How do I get a list of keys?
#2

[eluser]Nick_MyShuitings[/eluser]
If you check the driver that is not a function in the driver (read the code). Its also not the most common use case for memcache. Normally you'll have hard coded the key both before and after the SQL consult/model call.

Some quick searching http://www.php.net/manual/en/book.memcache.php and http://www.php.net/manual/en/book.memcached.php

shows us that those are not even possible functions with memcached. so perhaps if you explain your actual use case / need we could help with a solution that is possible by the actual extension and the driver.
#3

[eluser]zebric[/eluser]
This possibility would I need in order to maintain the data cache up to date.
For example:
There is a catalog that shows a list of brands and products that meet a list of each trademark.
Thus I cache list brands, key (for example): trademarks
and
a list of products that meet the trademark, the key (for example): trademarks_brand.

If I change, delete, add information about the brand, I need to clear the cache of key:
trademarks.
If I change, delete, add information about the product brand, then I need to clear your cache of keys:
trademarks, trademarks_brand.

I am wondering what are the methods of automation of clearing the cache.
#4

[eluser]Nick_MyShuitings[/eluser]
There you would be helped by convention that you yourself define. As long as you in your code follow your own convention you will be able to always know the name of the key.

For example, the trademark - Ford, would always be the key ford. and the products under ford, would always be ford_products.

Note that memcached keys are set with a timeout, so every time you attempt to get a key you check if it is set. If it is not set you then query the database and reset the keye. Similarly, after every WRITE SQL operation like insert update or delete, you would reset the key.

It sounds like you need to study more on what is memcached and how it works and the theory and logic behind it, a bit before you attempt to implement it in CI.
#5

[eluser]zebric[/eluser]
Thanks for the tips, be sure I will delve more deeply into details Memkeshed




Theme © iAndrew 2016 - Forum software by © MyBB