MemcachedClient mcc = new MemcachedClient(list); if(mcc.get("something")==null) { if(!DataFactory.Exist(somethingObject)) { DataFactory.StoreInDB(somethingObject); } mcc.set("something", 900, somethingObject).get(); } ReadObject readObject =mcc.get("something"); readObject.DoClientLogic();
MemcachedClient mcc = new MemcachedClient(list); if(mcc.get("something")==null) { if(!DataFactory.Exist(somethingObject)) { DataFactory.StoreInDB(somethingObject); } mcc.set("something", 900, somethingObject).get(); }
MemcachedClient mcc = new MemcachedClient(list); ReadObject readObject =new ReadObject(); if(mcc.get("something")==null) { readObject =DataFactory.ReadFromDB(somethingObject); } else { readObject =mcc.get("something"); } readObject.DoClientLogic();
碰到任何问题,请回复,共同讨论,谢谢!
高并发之Memcached实战第10课-“Memcached Get获取数据”部分代码分享2
原文地址:http://blog.csdn.net/yangzhenping/article/details/44704231