Organization of memcache keys

Im trying to find a good way to handle memcache keys to store, retrieve and update data to / from the cache level in a more civilized way.

I found this template that looks great, but how to turn it into a functional part of a PHP application?

Identity Card Scheme: http://martinfowler.com/eaaCatalog/identityMap.html

Thanks!

Update: I was told about the modified memcache (memcache-tag), which apparently does a lot, but I cannot install linux software in the windows development window ...

+3
source share
1 answer

Well, memcache uses an identity pattern. You check your cache, then fall into your database (or something else that you are using). You can find information about the source by saving objects, not just values, but for this you will get a performance hit.

In fact, you cannot request a cache that it contains as a list. For mass invalidity, you will need to save the list of what you have enclosed and repeat it, or you will have to sort through all possible keys that may correspond to the problem you are interested in. The resource you specify, memcache-tag, can simplify this, but it does not seem to be supported by the memcache project built-in.

So, your options are now iterative deletions or completely flush out everything that is cached. So I suggest considering design, this is a question you should ask. To get a useful answer for you, I ask: why do you want to do this?

+5
source

Source: https://habr.com/ru/post/889693/


All Articles