Need different types of caches
Abhishek
abhishek.pareek at yahoo.com
Fri Aug 11 12:43:39 UTC 2006
Hi,
I was trying my hand on memcache - java version, experimenting a little bit. What i cannot understand is how do I keep different types of caches on memcache. I tried creating two separate SocketIOPool connections with same server address but different ports. See below :-
public MemCacheImpl() {
String[] serverlist = {"172.16.2.82:11211"};
String[] serverlist2 = {"172.16.2.82:11212"};
// initialize the pool for memcache servers
SockIOPool pool = SockIOPool.getInstance();
SockIOPool pool2 = SockIOPool.getInstance();
pool.setServers(serverlist);
pool2.setServers(serverlist2);
pool.setInitConn(5);
pool.setMinConn(5);
pool.setMaxConn(50);
pool.setMaintSleep(30);
pool.setNagle(false);
pool.initialize();
//for pool2
pool2.setInitConn(5);
pool2.setMinConn(5);
pool2.setMaxConn(50);
pool2.setMaintSleep(30);
pool2.setNagle(false);
pool2.initialize();
}
It gave an exception as ++++++ trying to initialize an already initialized pool.
By different types of caches I mean I need to store PersonCache, ProjectCache in memcache. Currently I have these caches as implementation of Maps. But I want that a key of particular map(cache) goes into one memcache server. How can I do that?
ie.
PersonCache = Map
Key = personID
value = PersonValueObject
ProjectCache = Map
Key = projectID
Value = ProjectValueObject
Now, If I have two memcache servers running on different ports as mentioned above, how do I designate an Element(key-value) of PersonCache to go to only server1 and Element of ProjectCache to go to server2 ??
Can u pls tell me how can I create different caches on memcache? Also how can I create different configuration of SocketIOPool (s), so that they act as 'different caches' ??
Regards,
Abbey.
---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.danga.com/pipermail/memcached/attachments/20060811/70fd22cf/attachment.html
More information about the memcached
mailing list