Working on a caching modal for a small project i am working on. I've implemented memcached for the cache technology.
I am trying to save roughly around 750kb of data in a formatted array in a single key. the problem is, on each request, i only need 5% of the data, so getting all the data in a single call is a waste of network resources. I know i can create multiple keys with specific data set but i am trying to minimize the number of connections to the memcached server.
Question is. is there a way i can query memcached to just get part of the key value?
Typically how you divide your data in one key or multiple keys it is depends on use case.
But as you mentioned you required only 5% of data, then it will be good you divide your data into multiple keys. Memcache connects time and network latency you can reduce by using local Memcache.
local Memcache means Memcache will be on the same machine where your web server and each web server has its own small instance of Memcache locally. It will reduce to network latency. Because all communication has done at 127.0.0.1 (locally)
At that information required shared across the web server like session, you can keep it Global Memcache. it will improve you website scalability and at the same time cache segregation.