{"id":37021920,"url":"https://github.com/m3dev/method-cache-interceptor","last_synced_at":"2026-01-14T02:36:34.529Z","repository":{"id":4602153,"uuid":"5745240","full_name":"m3dev/method-cache-interceptor","owner":"m3dev","description":"Method Result Cache Interceptor for Java Applications","archived":true,"fork":false,"pushed_at":"2013-03-16T05:08:21.000Z","size":139,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":65,"default_branch":"master","last_synced_at":"2025-12-16T13:30:30.297Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/m3dev.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-10T05:24:41.000Z","updated_at":"2023-11-10T03:46:41.000Z","dependencies_parsed_at":"2022-09-26T21:50:45.895Z","dependency_job_id":null,"html_url":"https://github.com/m3dev/method-cache-interceptor","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/m3dev/method-cache-interceptor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m3dev%2Fmethod-cache-interceptor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m3dev%2Fmethod-cache-interceptor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m3dev%2Fmethod-cache-interceptor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m3dev%2Fmethod-cache-interceptor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m3dev","download_url":"https://codeload.github.com/m3dev/method-cache-interceptor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m3dev%2Fmethod-cache-interceptor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2026-01-14T02:36:34.073Z","updated_at":"2026-01-14T02:36:34.516Z","avatar_url":"https://github.com/m3dev.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Method Cache Interceptor\n\n## Getting Started\n\n### Maven\n\n```xml\n\u003cdependencies\u003e\n  \u003cdependency\u003e\n    \u003cgroupId\u003ecom.m3\u003c/groupId\u003e\n    \u003cartifactId\u003emethod-cache-interceptor\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.1\u003c/version\u003e\n  \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\n## Usage with Memcached\n\n### memcached-client-facade\n\nMemcachedCacheResultInterceptor uses memcached-client-facade internally.\n\nAlso take a look at memcached-client-facade's document:\n\nhttps://github.com/m3dev/memcached-client-facade\n\n### Setup for Spring Framework\n\n\"applicationContext.xml\" as follows:\n\n```xml\n\u003cbean id=\"memcachedConfiguration\" class=\"com.m3.memcached.facade.Configuration\"\u003e\n  \u003cproperty name=\"namespace\" value=\"com.m3.example\" /\u003e\n  \u003cproperty name=\"adaptorClassName\" value=\"com.m3.memcached.facade.adaptor.SpymemcachedAdaptor\" /\u003e\n  \u003cproperty name=\"addressesAsString\" value=\"127.0.0.1:11211,127.0.0.1:11212\" /\u003e\n\u003c/bean\u003e\n\n\u003cbean id=\"memcachedCacheResultInterceptor\" class=\"com.m3.methodcache.interceptor.MemcachedCacheResultInterceptor\"/\u003e\n\n\u003caop:config\u003e\n  \u003caop:advisor advice-ref=\"memcachedCacheResultInterceptor\" pointcut=\"...\"/\u003e\n\u003c/aop:config\u003e\n```\n\n### Setup by inheritence\n\nIt's also possible to inject the configuration to interceptor by inheritence.\n\n```java\nimport com.m3.methodcache.MemcachedCacheResultInterceptor;\nimport com.m3.memcached.facade.Configuration;\n\npublic class MyMemcachedInterceptor extends MemcachedCacheResultInterceptor {\n\n  @Override\n  public Configuration getConfiguration() {\n    Configuration config = new Configuration();\n    config.setNamespace(\"....\");\n    ...\n    return config;\n  }\n\n}\n```\n\n### Using AOP\n\nThe value will be cached for the duration of 10 seconds.\n\n```java\npackage service;\n\nimport com.m3.methodcache.annotation.CacheResult;\n\npublic class DateService {\n\n  @CacheResult(secondsToExpire = 10)\n  public String getCurrentAsString(String prefix) {\n    return prefix + new java.util.Date().toString();\n  }\n\n}\n```\n\n### The rule of generated cache key\n\n```\n\"(namespace)::(Method#toGenericString() and replace \"\\\\s+\" to \"_\")::(args separated by comma)\"\n```\n\nFor example:\n\n```java\nString result = new DateService().getCurrentAsString(\"PREFIX\");\n```\n\nAnd thn, the returned value will be cached as \"com.example::public_void_service.DateService.getCurrentAsString(String)::PREFIX\" on memcached.\n\n\n### Example\n\nSee also:\n\nhttps://github.com/m3dev/method-cache-interceptor/tree/master/sample\n\n## License\n\n```\n Copyright 2011 - 2012 M3, Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n either express or implied. See the License for the specific language\n governing permissions and limitations under the License.\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm3dev%2Fmethod-cache-interceptor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm3dev%2Fmethod-cache-interceptor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm3dev%2Fmethod-cache-interceptor/lists"}