2013年12月19日星期四

Memcache how the key management

 This post last edited by the Anders_Zhuo on 2013-11-04 23:36:59
I do back in the game development companies, some data will be temporary to memcache

But when it came to developing such a question:

lot of background development in their own writing extension classes which use memcahce, will declare their own key.

Thus, for me to write my extended class, to use memcache, declared key , I was a bit tangled

I do not know which key has been used , I can not go to other people , I read through the code and see what key has been used. This is too cumbersome

Ever since, I do not know how to do ?

sum up the problem :

1 memcache the key how to manage it, is to put all the key are written in a separate statement inside a class , or write in a configuration file, so if you use a key which others can know . . Or are there better ways ? ? ? ?

For example, class A which has the code : memcache.set ("key1", value); memcache.set ("key2", value2);
< br /> then class B which also has some of this code , memcache.set ("key3", value); memcache.set ("key4", value2);

also there are class C, class D , and so too much

so I set method when I do not know which key has been used by others .


2 memcache now there are a lot of data , and also can not be deleted , I want to know what key, how do you know ? ?
I checked on the Internet , there is a way a lot of trouble :
telnet connection memcache, stats items, then stats item index 0 this will put all the key listed, but it feels a lot of trouble , there is no other way to know what has been using key????




------ Solution ------------------------------------ --------

first, your avatar protest.
key statement for each project should have its own rules , your own set like.
The easiest way : project name , delimiter , the module name , delimiter, function name , delimiter , key you use. Small projects unlikely to repeat .
------ For reference only -------------------------------------- -


Under this you ask my colleagues should give you answer it
------ For reference only ------------------- --------------------
does this thing do not need to go global constraints , or interact with a few per cent more cache , each upper application to make a conventions like
------ For reference only ---------------------------------- -----
this comparison approach is to do kung fu provincial convention slightly, to achieve perfect configuration is quite troublesome cough is not considered half-baked
------ For reference only ---------------------------------------
All are written in the same key the next class like, ah , you need to go to class adds new content under Key , of course, everyone put their use in a range of key inside, so it will not conflict .
------ For reference only -------------------------------------- -

first, your avatar protest.      
key statement for each project should have its own rules , your own set like.   
The easiest way : project name , delimiter , the module name , delimiter, function name , delimiter , key you use. Small projects unlikely to repeat .  

this picture , I spent a whole year now ! Protest is invalid !

没有评论:

发表评论