{"id":21206244,"url":"https://github.com/rtmigo/jaseca_kt","last_synced_at":"2026-04-29T13:31:38.766Z","repository":{"id":60374449,"uuid":"542707945","full_name":"rtmigo/jaseca_kt","owner":"rtmigo","description":"Easy to use file cache for Kotlin/JVM. Serializes Java classes and stores the data in a directory on a local drive.","archived":false,"fork":false,"pushed_at":"2022-10-22T07:41:15.000Z","size":110,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"staging","last_synced_at":"2025-01-21T15:32:16.741Z","etag":null,"topics":["cache","caching","directory","ehcache","file","filesystem","hdd","java","jvm","kotlin","local","persistence","persistent"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rtmigo.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2022-09-28T17:18:17.000Z","updated_at":"2022-10-22T07:42:18.000Z","dependencies_parsed_at":"2023-01-20T09:48:01.857Z","dependency_job_id":null,"html_url":"https://github.com/rtmigo/jaseca_kt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Fjaseca_kt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Fjaseca_kt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Fjaseca_kt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Fjaseca_kt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rtmigo","download_url":"https://codeload.github.com/rtmigo/jaseca_kt/tar.gz/refs/heads/staging","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243658274,"owners_count":20326467,"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":["cache","caching","directory","ehcache","file","filesystem","hdd","java","jvm","kotlin","local","persistence","persistent"],"created_at":"2024-11-20T20:54:58.642Z","updated_at":"2026-04-29T13:31:33.736Z","avatar_url":"https://github.com/rtmigo.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [jaseca](https://github.com/rtmigo/jaseca_kt)\n\nEasy to use file cache for Kotlin/JVM.\n\nStores data in a directory on a local drive. Allows you to keep data of any types that are \n`java.io.Serializable`.\n\n```kotlin\nimport io.github.rtmigo.jaseca.filecache\nimport java.nio.file.Paths\n\nfun main() {\n\n    filecache\u003cString, Int\u003e(Paths.get(\"/path/to/cache_dir\"))\n        .use { cache -\u003e\n            // writing to cache\n            cache[\"first key\"] = 10\n            cache[\"second key\"] = 20\n            // reading from cache\n            println(cache[\"first key\"])\n        }\n}\n```\n\n\"Jaseca\" stands for **JA**va.io.**SE**rializable **CA**che.\n\nIn fact, this is a thin wrapper around [Ehcache](https://www.ehcache.org/).\n\n\n# Install\n\n#### settings.gradle.kts\n\n```kotlin\nsourceControl {\n    gitRepository(java.net.URI(\"https://github.com/rtmigo/jaseca_kt.git\")) {\n        producesModule(\"io.github.rtmigo:jaseca\")\n    }\n}\n```\n\n#### build.gradle.kts\n\n```kotlin\ndependencies {\n    implementation(\"io.github.rtmigo:jaseca\") {\n        version { branch = \"staging\" }\n    }\n}\n```\n\n# Use\n\n### Configure, write, read\n\n```kotlin\nimport io.github.rtmigo.jaseca.filecache\nimport java.nio.file.Paths\nimport kotlin.time.Duration.Companion.minutes\n\nfun main() {\n\n    filecache\u003cString, Int\u003e(Paths.get(\"/path/to/cache_dir\")) {\n        // optional configuration block\n        maxEntries = 1000\n        timeToIdle = 15.minutes\n    }\n        .use { cache -\u003e\n            // writing to cache\n            cache[\"first key\"] = 10\n            cache[\"second key\"] = 20\n            // reading from cache\n            println(cache[\"first key\"])\n        }\n}\n```\n\n:warning: You should always use the cache inside `use { }` block or call `.close()` \nafter use. Otherwise, the data may not be saved to disk.\n\n### Save structured data\n\nJust inherit your Kotlin class from `java.io.Serializable` to make it compatible.\n\n```kotlin\nimport io.github.rtmigo.jaseca.filecache\nimport java.nio.file.Paths\n\ndata class Planet(val radius: Double, val period: Double)\n    : java.io.Serializable  // this makes the object compatible\n\nfun main() {\n\n    filecache\u003cString, Planet\u003e(Paths.get(\"/path/to/cache_dir\"))\n        .use { cache -\u003e\n            cache[\"Mars\"] = Planet(389.5, 686.980)\n            cache[\"Mercury\"] = Planet(2439.7, 87.9691)\n        }\n}\n```\n\n## License\n\nCopyright © 2022 [Artyom IG](https://github.com/rtmigo).\nReleased under the [Apache-2.0](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtmigo%2Fjaseca_kt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frtmigo%2Fjaseca_kt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtmigo%2Fjaseca_kt/lists"}