Java memcached simple Encapsulation

Source: Internet
Author: User

Memcached is a distributed cache system. It was originally named danga.
Interactive was developed for livejournal, but is currently used by many software such as mediawiki. This is a set of open-source software that is licensed by BSD license. With the development of distributed computing, it is more and more difficult to obtain consistent computing results when the memory is consistent between machines. With the development of the machine's geometric level, centralized cache becomes increasingly available. Javaframework2.5 has also integrated centralized cache operations.

Package COM. shine. framework. memcached. example; import COM. shine. framework. memcached. memcachedmanager; public class memcachedmanagerbasetest {/*** @ Param ARGs */public static void main (string [] ARGs) {// initialize the centralized cache system memcachedmanager. getmanager (). addmemcachepool ("cache", "192.168.2.212: 11211"); // Add the specified data to the cache's centralized cache memcachedmanager. getmanager (). add ("cache", "test", "test"); // print the retrieved centralized cache data system. out. println (memcachedmanager. getmanager (). get ("cache", "test"); // replaces memcachedmanager. getmanager (). replace ("cache", "test", "replace"); // print the retrieved centralized cache data system. out. println (memcachedmanager. getmanager (). get ("cache", "test"); // replaces memcachedmanager. getmanager (). delete ("cache", "test"); // print the retrieved centralized cache data system. out. println (memcachedmanager. getmanager (). get ("cache", "test "));}}

SVN address for the entire project: https://ken-javaframeword.googlecode.com/svn/trunk/JavaFramework2.5

Memcachedmanager entry address: http://ken-javaframeword.googlecode.com/svn/trunk/JavaFramework2.5/src/com/shine/framework/Memcached/MemCachedManager.java




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.