{"id":33179589,"url":"https://github.com/Cetsoft/imcache","last_synced_at":"2025-12-25T13:01:24.087Z","repository":{"id":10627234,"uuid":"12849994","full_name":"Cetsoft/imcache","owner":"Cetsoft","description":"Imcache is a Java Caching Library.","archived":false,"fork":false,"pushed_at":"2022-12-16T05:05:15.000Z","size":1581,"stargazers_count":128,"open_issues_count":5,"forks_count":40,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-07-13T03:15:03.860Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"puppetlabs-education/classroom-control-vf","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cetsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license-header.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-09-15T18:13:45.000Z","updated_at":"2024-12-07T14:03:23.000Z","dependencies_parsed_at":"2023-01-13T16:03:33.670Z","dependency_job_id":null,"html_url":"https://github.com/Cetsoft/imcache","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/Cetsoft/imcache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cetsoft%2Fimcache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cetsoft%2Fimcache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cetsoft%2Fimcache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cetsoft%2Fimcache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cetsoft","download_url":"https://codeload.github.com/Cetsoft/imcache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cetsoft%2Fimcache/sbom","scorecard":{"id":28224,"data":{"date":"2025-08-11","repo":{"name":"github.com/Cetsoft/imcache","commit":"d929397a9b4990917d08a06205e3e8d552fba483"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.5,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/18 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENCE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 13 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-14T18:25:24.089Z","repository_id":10627234,"created_at":"2025-08-14T18:25:24.089Z","updated_at":"2025-08-14T18:25:24.089Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28030190,"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","status":"online","status_checked_at":"2025-12-25T02:00:05.988Z","response_time":58,"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":"2025-11-16T03:00:36.838Z","updated_at":"2025-12-25T13:01:24.082Z","avatar_url":"https://github.com/Cetsoft.png","language":"Java","funding_links":[],"categories":["缓存库"],"sub_categories":[],"readme":"imcache\n=======\nImcache is a Java Caching Library.Imcache intends to speed up applications by providing a means to manage cached data. It offers solutions ranging from small applications to large scale applications. It supports n-level caching hierarchy where it supports various kind of caching methods like heap, offheap, and more. Imcache also supports well-known caching solution, redis. To extend, you can define a heapcache backed by offheap cache which is also backed by database. If a key is not found in heap, it will be asked to offheap and so on. \n\n[![Build Status](https://travis-ci.org/Cetsoft/imcache.svg)](https://travis-ci.org/Cetsoft/imcache)\n[![Coverage Status](https://coveralls.io/repos/Cetsoft/imcache/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/Cetsoft/imcache?branch=master)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.cetsoft/imcache/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.cetsoft/imcache/)\n[![License](http://img.shields.io/:license-apache-brightgreen.svg)](http://www.apache.org/licenses/LICENSE-2.0.html) [![Join the chat at https://gitter.im/Cetsoft/imcache](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Cetsoft/imcache?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n### Reference\nIn order to use imcache, you need to specify your dependency as follows:\n#### Maven\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.cetsoft\u003c/groupId\u003e\n  \u003cartifactId\u003eimcache\u003c/artifactId\u003e\n  \u003cversion\u003e0.3.0\u003c/version\u003e\u003c!--Can be updated for later versions--\u003e\n\u003c/dependency\u003e\n```\n#### Gradle\n```groovy\ncompile group: 'com.cetsoft', name: 'imcache', version: '0.3.0'\n```\nFor full dependency reference: https://mvnrepository.com/artifact/com.cetsoft/imcache\n### Simple Application\n```java\nfinal Cache\u003cString,User\u003e cache = CacheBuilder.heapCache().\ncacheLoader(new CacheLoader\u003cString, User\u003e() {\n    public User load(String key) {\n        return userDAO.get(key);\n    }\n}).evictionListener(new EvictionListener\u003cString, User\u003e{\n    public onEviction(String key, User user){\n        userDAO.save(key, user);\n    }\n}).capacity(10000).build();\n//If there is not a user in the heap cache it'll be loaded via userDAO.\nfinal User user = cache.get(\"#unique identifier\"); \nfinal User newUser = new User(\"email\", \"Richard\", \"Murray\")\n//When maximum value for cache size is reached, eviction event occurs.\n//In case of eviction, newUser will be saved to db.\ncache.put(newUser.getEmail(), newUser);\n```\n### The Cache Interface\nImcache supports simple operation defined by the cache interface. Cache interface provides general methods that is implemented by all imcache caches. See the methods below.\n```java\npublic interface Cache\u003cK, V\u003e {\n    void put(K key, V value);\n    void put(K key, V value, TimeUnit expiryUnit, long expiry);\n    V get(K key);\n    V invalidate(K key);\n    void clear();\n    CacheStats stats();\n    String getName();\n    int size();\n}\n```\n### The Cache Builder\nCache Builder is one of the core asset of the imcache. You can create simple heapCaches to complexOffHeapCaches via \nCache Builder. Let's see Cache Builder in action below.\n```java\nvoid example(){\n    final Cache\u003cInteger,Integer\u003e cache = CacheBuilder.heapCache().\n    cacheLoader(new CacheLoader\u003cInteger, Integer\u003e() {\n  \t//Here you can load the key from another cache like offheapcache\n        public Integer load(Integer key) {\n            return null;\n        }\n    }).capacity(10000).build(); \n}\n```\n### The Cache Loader\nThe CacheLoader interface for loading values with specified keys. The class that is interested in loading values \nfrom a resource implements this interface. When data is not found the cache, load method of CacheLoader is called.\n### The Eviction Listener\nThe listener interface for receiving eviction events. The class that is interested in processing a eviction event\nimplements this interface. When the eviction event occurs,that object's onEviction method is invoked.\n### The Heap Cache\nHeapCache uses LRU(Least Recently Used) as eviction strategy by the help of caffeine. \nAs a result, caffeine discards the least recently used items first when eviction required.\nEviction occurs if the size of the cache is equal to the cache capacity in a put operation\n### The Off Heap Cache\nThe Class OffHeapCache is a cache that uses offheap byte buffers to store or retrieve data by serializing\nitems into bytes. To do so, OffHeapCache uses pointers to point array location of an item. OffHeapCache clears\nthe buffers periodically to gain free space if buffers are dirty(unused memory). It also does eviction depending on\naccess time to the objects.\nTo make offheap cache work to JVM Parameters \u003cb\u003e\"-XX:MaxDirectMemorySize=4g\"\u003c/b\u003e must be set. Buffer capacity of 8 mb \nis a good choice to start OffHeapCache. Let's see sample OffHeapCache use.\n```java\nvoid example(){\n    //8388608 is 8 MB and 10 buffers. 8MB*10 = 80 MB.\n    final OffHeapByteBufferStore bufferStore = new OffHeapByteBufferStore(8388608, 10);\n    final Cache\u003cInteger,SimpleObject\u003e offHeapCache = CacheBuilder.offHeapCache().\n    storage(bufferStore).build();\n}\n```\nBy default configuration, OffHeapCache will try to clean the places which are not used and marked as \ndirty periodically. What is more, it will do eviction periodically, too.\n\n### The Versioned Off Heap Cache\nThe Class VersionedOffHeapCache is a type of offheap cache where cache items have versions that are incremented for each update.\nTo make versioned off heap cache work to JVM Parameters \u003cb\u003e\"-XX:MaxDirectMemorySize=4g\"\u003c/b\u003e must be set. Buffer capacity of 8 mb \nis a good choice to start VersionedOffHeapCache. Let's see sample VersionedOffHeapCache use.\n```java\nvoid example(){\n    //8388608 is 8 MB and 10 buffers. 8MB*10 = 80 MB.\n    final OffHeapByteBufferStore bufferStore = new OffHeapByteBufferStore(8388608, 10);\n    final Cache\u003cInteger,VersionedItem\u003cSimpleObject\u003e\u003e offHeapCache = \n    CacheBuilder.versionedOffHeapCache().storage(bufferStore).build();\n    VersionedItem\u003cSimpleObject\u003e versionedItem = offHeapCache.get(12);\n}\n```\n\n### Redis Cache\nRedisCache is a cache that uses redis server for storing or retrieving data by serializing items into bytes. Please check out [redis documentation](http://redis.io/documentation), and [download redis server](http://redis.io/download). Redis Cache doesn't have any capability of managing or dealing with redis cluster. Redis Cache can only talk to one redis server for the time being.\n```java\nvoid example(){\n    Cache\u003cInteger, String\u003e cache = CacheBuilder.redisCache().\n\t\t\thostName(HOSTNAME).port(PORT).build();\n    cache.put(1, \"apple\");\n    System.out.println(cache.get(1));\n}\n```\n\n### Searching, Indexing and Query Execution\nimcache provides searching for all the caches by default. Searching is done by execute method of SearchableCache.\nExecute method takes a Query as an input and returns results as list. A query consists of criteria and filter. Here\nis an example use for queries.\n```java\nvoid example(){\n    SearchableCache\u003cInteger, SimpleObject\u003e cache = CacheBuilder.heapCache().\n    addIndex(\"j\", IndexType.RANGE_INDEX).build();\n    cache.put(0, createObject());\n    cache.put(1, createObject());\n    cache.put(2, createObject());\n    List\u003cSimpleObject\u003e objects = cache.execute(CacheQuery.newQuery().\n    setCriteria(new BetweenCriteria(\"j\",1,3).or(new ETCriteria(\"j\", 3))).\n    setFilter(new LEFilter(\"k\", 3)));\n    for (SimpleObject simpleObject : objects) {\n        System.out.println(simpleObject);\n    }\n}\n```\nNote that queries to caches that live outside of JVM can't be executed. Thus, querying redis and memcache isn't possible.\n\n\u003ci\u003eTo learn more about imcache please look at examples provided.\u003c/i\u003e\n\n## Support\n### Contributing\n#### Compiling Project\n`./mvnw install -DskipTests -Dgpg.skip`\n#### License Header\n`./mvnw license:format`\n#### Coverage\n`./mvnw clean verify -Dgpg.skip`\nOpen `${module}/target/site/jacoco/index.html` where module is imcache-core, imcache-heap and etc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCetsoft%2Fimcache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCetsoft%2Fimcache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCetsoft%2Fimcache/lists"}