Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ragnor/simple-spring-memcached
A drop-in library to enable memcached caching in Spring beans via annotations
https://github.com/ragnor/simple-spring-memcached
annotations cache caching java memcached spring spring-cache
Last synced: 4 days ago
JSON representation
A drop-in library to enable memcached caching in Spring beans via annotations
- Host: GitHub
- URL: https://github.com/ragnor/simple-spring-memcached
- Owner: ragnor
- License: mit
- Created: 2014-02-07T10:33:57.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2023-02-03T14:29:52.000Z (almost 2 years ago)
- Last Synced: 2025-01-15T04:35:35.750Z (18 days ago)
- Topics: annotations, cache, caching, java, memcached, spring, spring-cache
- Language: Java
- Size: 3.46 MB
- Stars: 188
- Watchers: 32
- Forks: 91
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.txt
- License: LICENSE
Awesome Lists containing this project
README
Simple Spring Memcached
=======================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 on [google code](https://code.google.com/p/simple-spring-memcached).**
## 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 check [release notes](https://github.com/ragnor/simple-spring-memcached/wiki/Relase-notes).**This project enables caching in Spring-managed beans, by using Java 5 Annotations and Spring/AspectJ AOP on top of the [spymemcached](https://github.com/couchbase/spymemcached), [xmemcached](https://github.com/killme2008/xmemcached/) or [aws-elasticache](https://github.com/amazonwebservices/aws-elasticache-cluster-client-memcached-for-java) 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:
com.google.code.simple-spring-memcached
xmemcached-provider
4.1.3
and define connection to memcached on localhost using java based configuration:
@Configuration
public 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:
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 another [back-end](https://github.com/ragnor/simple-spring-memcached/wiki/Getting-Started#spring-31-cache-integration).
Need more? Please read [getting started guide](https://github.com/ragnor/simple-spring-memcached/wiki/Getting-Started).
## Documentation ##
Project documentation is available on [SSM wiki](https://github.com/ragnor/simple-spring-memcached/wiki).
Javadocs of current release are hosted on [github.io](http://ragnor.github.io/simple-spring-memcached/).
Source code from master branch is built and tested on:
* codeship: [ ![Codeship Status for ragnor/simple-spring-memcached](https://app.codeship.com/projects/ceb653a0-aee7-0136-c667-468d14f4260c/status?branch=master)](https://app.codeship.com/projects/310061)## Contact Us ##
If you have any questions, feel free to ask them on the [Google Group](http://groups.google.com/group/simple-spring-memecached). (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.