{"id":50879160,"url":"https://github.com/cachly-dev/sdk-java","last_synced_at":"2026-06-15T12:03:55.349Z","repository":{"id":351888256,"uuid":"1212925905","full_name":"cachly-dev/sdk-java","owner":"cachly-dev","description":"Official Cachly sdk-java SDK","archived":false,"fork":false,"pushed_at":"2026-04-16T22:16:51.000Z","size":66,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-16T23:38:39.025Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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/cachly-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-16T21:45:49.000Z","updated_at":"2026-04-16T22:16:54.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/cachly-dev/sdk-java","commit_stats":null,"previous_names":["cachly-dev/sdk-java"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/cachly-dev/sdk-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cachly-dev%2Fsdk-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cachly-dev%2Fsdk-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cachly-dev%2Fsdk-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cachly-dev%2Fsdk-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cachly-dev","download_url":"https://codeload.github.com/cachly-dev/sdk-java/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cachly-dev%2Fsdk-java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34361404,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-15T02:00:07.085Z","response_time":63,"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-06-15T12:03:55.171Z","updated_at":"2026-06-15T12:03:55.334Z","avatar_url":"https://github.com/cachly-dev.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cachly Java SDK\n\n\u003e Official Java SDK for [cachly.dev](https://cachly.dev) —  \n\u003e Managed Valkey/Redis cache built for AI apps. **GDPR-compliant · German servers · Live in 30 seconds.**\n\n[![Maven Central](https://img.shields.io/maven-central/v/dev.cachly/cachly-java?logo=apache-maven)](https://central.sonatype.com/artifact/dev.cachly/cachly-java)\n[![Java 17+](https://img.shields.io/badge/Java-17%2B-orange?logo=openjdk)](https://central.sonatype.com/artifact/dev.cachly/cachly-java)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](../../LICENSE)\n[![GDPR: EU-only](https://img.shields.io/badge/GDPR-EU%20only-green)](https://cachly.dev/legal)\n\n## Installation\n\n**Maven:**\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003edev.cachly\u003c/groupId\u003e\n  \u003cartifactId\u003ecachly-java\u003c/artifactId\u003e\n  \u003cversion\u003e0.1.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n**Gradle:**\n```groovy\nimplementation 'dev.cachly:cachly-java:0.1.1'\n```\n\n\u003e Requires Java 17+. Uses Jedis 5 and Jackson.\n\n## Quick Start\n\n```java\nimport dev.cachly.CachlyClient;\n\ntry (CachlyClient cache = CachlyClient.connect(System.getenv(\"CACHLY_URL\"))) {\n\n    // Set with TTL\n    cache.set(\"user:42\", Map.of(\"name\", \"Alice\", \"plan\", \"pro\"), 300);\n\n    // Get\n    Map\u003c?, ?\u003e user = cache.get(\"user:42\", Map.class);\n\n    // Exists / delete\n    cache.exists(\"user:42\");\n    cache.del(\"user:42\");\n\n    // Atomic counter\n    long count = cache.incr(\"page:views\");\n}\n```\n\n## Get-or-Set Pattern\n\n```java\nReport report = cache.getOrSet(\n    \"report:monthly\",\n    () -\u003e db.runExpensiveReport(),\n    Report.class,\n    60  // TTL seconds\n);\n```\n\n## Semantic AI Cache (Speed / Business tiers)\n\n```java\nimport dev.cachly.CachlyClient;\nimport dev.cachly.SemanticResult;\n\ntry (CachlyClient cache = CachlyClient.connect(System.getenv(\"CACHLY_URL\"))) {\n\n    SemanticResult\u003cString\u003e result = cache.semantic().getOrSet(\n        userQuestion,\n        () -\u003e openAI.ask(userQuestion),          // expensive call on cache miss\n        text -\u003e openAI.embed(text),              // embedding function\n        0.92,                                    // similarity threshold\n        3600,                                    // TTL seconds\n        \"cachly:sem\"                             // namespace\n    );\n\n    System.out.printf(\"%s %s%n\",\n        result.isHit() ? \"⚡ hit (sim=\" + result.getSimilarity() + \")\" : \"🔄 miss\",\n        result.getValue());\n}\n```\n\n## Spring Boot Integration\n\n```java\n@Configuration\npublic class CachlyConfig {\n    @Value(\"${cachly.url}\") private String url;\n\n    @Bean(destroyMethod = \"close\")\n    public CachlyClient cachlyClient() {\n        return CachlyClient.connect(url);\n    }\n}\n\n// In a service:\n@Service\npublic class UserService {\n    private final CachlyClient cache;\n\n    public UserService(CachlyClient cache) {\n        this.cache = cache;\n    }\n\n    public User getUser(String id) {\n        return cache.getOrSet(\"user:\" + id, () -\u003e userRepo.findById(id), User.class, 300);\n    }\n}\n```\n\n## API Reference\n\n| Method | Description |\n|---|---|\n| `connect(url)` | Create client from Redis URL |\n| `get(key, Class\u003cT\u003e)` | Get value (null if not found) |\n| `set(key, value, ttlSeconds)` | Set value |\n| `del(String... keys): long` | Delete keys |\n| `exists(key): boolean` | Check existence |\n| `expire(key, seconds)` | Update TTL |\n| `incr(key): long` | Atomic increment |\n| `getOrSet(key, fn, Class\u003cT\u003e, ttl)` | Get-or-set pattern |\n| `semantic()` | `SemanticCache` helper |\n| `raw()` | Direct `UnifiedJedis` access |\n\n## Batch API — Multiple Ops in One Round-Trip\n\nBundle GET/SET/DEL/EXISTS/TTL operations into **one** HTTP request or Jedis pipeline.\n\n```java\nCachlyClient cache = CachlyClient.builder()\n    .url(System.getenv(\"CACHLY_URL\"))\n    .batchUrl(System.getenv(\"CACHLY_BATCH_URL\")) // optional\n    .build();\n\nList\u003cBatchOpResult\u003e results = cache.batch(List.of(\n    BatchOp.get(\"user:1\"),\n    BatchOp.get(\"config:app\"),\n    BatchOp.set(\"visits\", \"42\", 86400),\n    BatchOp.exists(\"session:xyz\"),\n    BatchOp.ttl(\"token:abc\")\n));\n\nString  user  = results.get(0).getValue();         // null on miss\nboolean ok    = results.get(2).isOk();\nboolean found = results.get(3).isExists();\nlong    secs  = results.get(4).getTtlSeconds();    // -1 = no TTL, -2 = key missing\n```\n\n---\n\n## AI Dev Brain — Persistent Memory for Your Coding Assistant\n\ncachly ships a **30-tool MCP server** that gives Claude Code, Cursor, GitHub Copilot, and Windsurf a persistent memory across sessions — so they never forget your architecture, lessons learned, or last session context.\n\n```bash\nnpx @cachly-dev/init\n```\n\nOr configure manually in your editor (`~/.vscode/mcp.json` / `.cursor/mcp.json`):\n\n```json\n{\n  \"servers\": {\n    \"cachly\": {\n      \"type\": \"stdio\",\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@cachly-dev/mcp-server\"],\n      \"env\": { \"CACHLY_JWT\": \"your-jwt-token\" }\n    }\n  }\n}\n```\n\n`session_start(instance_id, focus)` returns a full briefing in one call: last session summary, relevant lessons, open failures, brain health. 60 % fewer file reads, instant context, zero re-discovery.\n\n→ Full docs: [cachly.dev/docs/ai-memory](https://cachly.dev/docs/ai-memory)\n\n---\n\n## Environment Variables\n\n```bash\nCACHLY_URL=redis://:your-password@my-app.cachly.dev:30101\nCACHLY_BATCH_URL=https://api.cachly.dev/v1/cache/YOUR_TOKEN   # optional\n# Speed / Business tier – Semantic AI Cache:\nCACHLY_VECTOR_URL=https://api.cachly.dev/v1/sem/your-vector-token\n```\n\nFind both values in your [cachly.dev dashboard](https://cachly.dev/instances).\n\n## Links\n\n- 📖 [cachly.dev docs](https://cachly.dev/docs)\n- 🧠 [AI Memory / MCP Server](https://cachly.dev/docs/ai-memory)\n- 🐛 [Issues](https://github.com/cachly-dev/sdk-java/issues)\n- 📦 [Maven Central](https://central.sonatype.com/artifact/dev.cachly/cachly-java)\n\n---\n\nMIT © [cachly.dev](https://cachly.dev)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcachly-dev%2Fsdk-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcachly-dev%2Fsdk-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcachly-dev%2Fsdk-java/lists"}