Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A drop-in library to enable memcached caching in Spring beans via annotations

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
license.txt
NotificationsYou must be signed in to change notification settings

ragnor/simple-spring-memcached

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A drop-in library to enable memcached caching in Spring beans via annotations.

Most of documentation has been moved to github but still some docs are available only ongoogle code.

Introduction

Distributed caching can be a big, hairy, intricate, and complex proposition when using it extensively.

Simple Spring Memcached (SSM) attempts to simplify implementation for several basic use cases.

(28-06-2019) New version 4.1.3 with Amazon ElastiCache, Spring 5.1/5.0/4.3 and Java based configuration support is available!SSM can also work as a cache back-end in Spring Cache (@Cacheable). Please checkrelease notes.

This project enables caching in Spring-managed beans, by using Java 5 Annotations and Spring/AspectJ AOP on top of thespymemcached,xmemcached oraws-elasticache client. Using Simple Spring Memcached requires only a little bit of configuration and the addition of some specific annotations on the methods whose output or input is being cached.

Usage

If you are using maven, you can try it now:

<dependencies>   <dependency>     <groupId>com.google.code.simple-spring-memcached</groupId>     <artifactId>xmemcached-provider</artifactId>     <version>4.1.3</version>   </dependency> </dependencies>

and define connection to memcached on localhost using java based configuration:

@Configurationpublic class LocalSSMConfiguration extends AbstractSSMConfiguration {    @Bean    @Overwrite    public CacheFactory defaultMemcachedClient() {        final CacheConfiguration conf = new CacheConfiguration();        conf.setConsistentHashing(true);        final CacheFactory cf = new CacheFactory();        cf.setCacheClientFactory(new com.google.code.ssm.providers.xmemcached.MemcacheClientFactoryImpl());        cf.setAddressProvider(new DefaultAddressProvider("127.0.0.1:11211"));        cf.setConfiguration(conf);        return cf;    }}

or in old fashion way using XML:

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop"xsi:schemaLocation="http://www.springframework.org/schema/beans        http://www.springframework.org/schema/beans/spring-beans-4.3.xsd        http://www.springframework.org/schema/aop        http://www.springframework.org/schema/aop/spring-aop-4.3.xsd">  <import resource="simplesm-context.xml" />  <aop:aspectj-autoproxy />  <bean name="defaultMemcachedClient">      <property name="cacheClientFactory">            <bean />      </property>      <property name="addressProvider">            <bean>                 <property name="address" value="127.0.0.1:11211" />            </bean>      </property>      <property name="configuration">            <bean>                  <property name="consistentHashing" value="true" />            </bean>      </property>   </bean></beans>

Now you can annotate method to cache result:

@ReadThroughSingleCache(namespace = "CplxObj", expiration = 3600)public ComplexObject getComplexObjectFromDB(@ParameterValueKeyProvider Long complexObjectPk) {  // ...  return result;}

If you already using Spring Cache you may use SSM as an anotherback-end.

Need more? Please readgetting started guide.

Documentation

Project documentation is available onSSM wiki.
Javadocs of current release are hosted ongithub.io.
Source code from master branch is built and tested on:

  • codeship:Codeship Status for ragnor/simple-spring-memcached

Contact Us

If you have any questions, feel free to ask them on theGoogle Group. (UPDATE: Sorry, this link was bad up until 02 Aug '09, because I fat-fingered when creating the Google Group. I incorrectly misspelled it as 'simple-spring-memEcached'. So sorry about that!)

Also, let us know if you are using SSM in your project, and we will list it in on the Wiki.

About

A drop-in library to enable memcached caching in Spring beans via annotations

Topics

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
license.txt

Stars

Watchers

Forks

Packages

No packages published

Contributors6

Languages


[8]ページ先頭

©2009-2025 Movatter.jp