Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App Engine - MemcacheService namespaces

(I may be totally off in my understanding here but I still would like to ask.)

The MemcacheServiceFactory can return a MemcacheService instance given a namespace.

Can one application request MemcacheService instances for more than one namespace? If yes, can namespace be used as a grouping concept?

For instance, say my model has folders and files and I use folder names as namespaces. I can store cached data for files that belong to a certain folder in the MemcacheService instance with that folder's name as the namespace. And when I delete the folder I simply clear all entries in this MemcacheService instance there by not affecting any other folders or files.

Thanks, Keyur

like image 888
Keyur Avatar asked Jun 10 '26 23:06

Keyur


1 Answers

Yes, you can get service implementations for any number of namespaces within the same application. Namespaces are intended to provide separation between different concerns using the memcache service from within the same app, to eliminate the need to mangle your keys to avoid collisions.

The approach you describe won't work because there's no way to get a list of all keys in a namespace, nor is there a way to clear all keys in one specific namespace (only the whole of memcache).

like image 200
Nick Johnson Avatar answered Jun 13 '26 13:06

Nick Johnson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!