{"id":14977602,"url":"https://github.com/ragnor/simple-spring-memcached","last_synced_at":"2025-04-12T21:27:54.604Z","repository":{"id":13912501,"uuid":"16611556","full_name":"ragnor/simple-spring-memcached","owner":"ragnor","description":"A drop-in library to enable memcached caching in Spring beans via annotations","archived":false,"fork":false,"pushed_at":"2023-02-03T14:29:52.000Z","size":3626,"stargazers_count":189,"open_issues_count":6,"forks_count":89,"subscribers_count":32,"default_branch":"master","last_synced_at":"2025-04-04T00:58:20.252Z","etag":null,"topics":["annotations","cache","caching","java","memcached","spring","spring-cache"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ragnor.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.txt","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-07T10:33:57.000Z","updated_at":"2025-03-16T22:02:39.000Z","dependencies_parsed_at":"2023-02-18T08:00:48.878Z","dependency_job_id":null,"html_url":"https://github.com/ragnor/simple-spring-memcached","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragnor%2Fsimple-spring-memcached","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragnor%2Fsimple-spring-memcached/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragnor%2Fsimple-spring-memcached/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragnor%2Fsimple-spring-memcached/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ragnor","download_url":"https://codeload.github.com/ragnor/simple-spring-memcached/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248633838,"owners_count":21136922,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["annotations","cache","caching","java","memcached","spring","spring-cache"],"created_at":"2024-09-24T13:55:58.427Z","updated_at":"2025-04-12T21:27:54.580Z","avatar_url":"https://github.com/ragnor.png","language":"Java","funding_links":[],"categories":["缓存库"],"sub_categories":["Spring Cloud框架"],"readme":"Simple Spring Memcached\n=======================\n\nA drop-in library to enable memcached caching in Spring beans via annotations.\n\n**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).**\n\n## Introduction ##\n\nDistributed caching can be a big, hairy, intricate, and complex proposition when using it extensively.\n\nSimple Spring Memcached (SSM) attempts to simplify implementation for several basic use cases.\n\n**(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!\nSSM 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).** \n\nThis 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. \n\n\n## Usage ##\n\nIf you are using maven, you can try it now:\n\n    \u003cdependencies\u003e\n       \u003cdependency\u003e\n         \u003cgroupId\u003ecom.google.code.simple-spring-memcached\u003c/groupId\u003e\n         \u003cartifactId\u003exmemcached-provider\u003c/artifactId\u003e\n         \u003cversion\u003e4.1.3\u003c/version\u003e\n       \u003c/dependency\u003e \n    \u003c/dependencies\u003e\n\nand define connection to memcached on localhost using java based configuration:\n\t\n    @Configuration\n    public class LocalSSMConfiguration extends AbstractSSMConfiguration {\n\t    @Bean\n\t    @Overwrite\n\t    public CacheFactory defaultMemcachedClient() {\n\t        final CacheConfiguration conf = new CacheConfiguration();\n\t        conf.setConsistentHashing(true);\n\t        final CacheFactory cf = new CacheFactory();\n\t        cf.setCacheClientFactory(new com.google.code.ssm.providers.xmemcached.MemcacheClientFactoryImpl());\n\t        cf.setAddressProvider(new DefaultAddressProvider(\"127.0.0.1:11211\"));\n\t        cf.setConfiguration(conf);\n\t        return cf;\n\t    }\n\t} \n\nor in old fashion way using XML:\n\n    \u003cbeans xmlns=\"http://www.springframework.org/schema/beans\" xmlns:aop=\"http://www.springframework.org/schema/aop\"\n    xsi:schemaLocation=\"http://www.springframework.org/schema/beans\n            http://www.springframework.org/schema/beans/spring-beans-4.3.xsd\n            http://www.springframework.org/schema/aop\n            http://www.springframework.org/schema/aop/spring-aop-4.3.xsd\"\u003e\n\n      \u003cimport resource=\"simplesm-context.xml\" /\u003e\n      \u003caop:aspectj-autoproxy /\u003e\n\n      \u003cbean name=\"defaultMemcachedClient\" class=\"com.google.code.ssm.CacheFactory\"\u003e\n          \u003cproperty name=\"cacheClientFactory\"\u003e\n                \u003cbean class=\"com.google.code.ssm.providers.xmemcached.MemcacheClientFactoryImpl\" /\u003e\n          \u003c/property\u003e\n          \u003cproperty name=\"addressProvider\"\u003e\n                \u003cbean class=\"com.google.code.ssm.config.DefaultAddressProvider\"\u003e\n                     \u003cproperty name=\"address\" value=\"127.0.0.1:11211\" /\u003e\n                \u003c/bean\u003e\n          \u003c/property\u003e\n          \u003cproperty name=\"configuration\"\u003e\n                \u003cbean class=\"com.google.code.ssm.providers.CacheConfiguration\"\u003e\n                      \u003cproperty name=\"consistentHashing\" value=\"true\" /\u003e\n                \u003c/bean\u003e\n          \u003c/property\u003e\n       \u003c/bean\u003e\n    \u003c/beans\u003e\n\nNow you can annotate method to cache result:\n\n    @ReadThroughSingleCache(namespace = \"CplxObj\", expiration = 3600)\n    public ComplexObject getComplexObjectFromDB(@ParameterValueKeyProvider Long complexObjectPk) {\n      // ...\n      return result;\n    }\n\nIf 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).\n\nNeed more? Please read [getting started guide](https://github.com/ragnor/simple-spring-memcached/wiki/Getting-Started).\n\n## Documentation ##\nProject documentation is available on [SSM wiki](https://github.com/ragnor/simple-spring-memcached/wiki).  \nJavadocs of current release are hosted on [github.io](http://ragnor.github.io/simple-spring-memcached/).  \nSource code from master branch is built and tested on:\n* 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)\n\n## Contact Us ##\n\nIf 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!)\n\nAlso, let us know if you are using SSM in your project, and we will list it in on the Wiki.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fragnor%2Fsimple-spring-memcached","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fragnor%2Fsimple-spring-memcached","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fragnor%2Fsimple-spring-memcached/lists"}