{"id":14977725,"url":"https://github.com/redis/lettucemod","last_synced_at":"2025-04-04T10:05:57.855Z","repository":{"id":38939128,"uuid":"315844269","full_name":"redis/lettucemod","owner":"redis","description":"Java client for Redis Modules","archived":false,"fork":false,"pushed_at":"2025-03-26T05:38:03.000Z","size":1982,"stargazers_count":53,"open_issues_count":16,"forks_count":22,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T09:05:03.157Z","etag":null,"topics":["client","java","lettuce","modules","redis","redisearch","redisgears","redisjson","redismod","redistimeseries","spring"],"latest_commit_sha":null,"homepage":"","language":"Java","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/redis.png","metadata":{"files":{"readme":"README.adoc","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-25T06:04:35.000Z","updated_at":"2025-03-26T05:34:34.000Z","dependencies_parsed_at":"2024-03-06T07:42:05.650Z","dependency_job_id":"781457c5-b1f9-418b-8e0b-b6abd75bcbaa","html_url":"https://github.com/redis/lettucemod","commit_stats":{"total_commits":520,"total_committers":19,"mean_commits":27.36842105263158,"dds":0.6115384615384616,"last_synced_commit":"8a6a1341c4630ae9561169209634dfa9426bdbac"},"previous_names":["redis-developer/mesclun","redis/lettucemod","redis-developer/lettucemod"],"tags_count":90,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis%2Flettucemod","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis%2Flettucemod/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis%2Flettucemod/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis%2Flettucemod/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redis","download_url":"https://codeload.github.com/redis/lettucemod/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246523896,"owners_count":20791444,"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":["client","java","lettuce","modules","redis","redisearch","redisgears","redisjson","redismod","redistimeseries","spring"],"created_at":"2024-09-24T13:56:12.538Z","updated_at":"2025-04-04T10:05:57.832Z","avatar_url":"https://github.com/redis.png","language":"Java","readme":"= LettuceMod\n:linkattrs:\n:icons: font\n:project-owner:   redis\n:project-name:    lettucemod\n:project-group:   com.redis\n:project-version: 4.2.1\n\nimage:https://github.com/{project-owner}/{project-name}/actions/workflows/early-access.yml/badge.svg[\"Build Status\",link=\"https://github.com/{project-owner}/{project-name}/actions/workflows/early-access.yml\"]\nimage:https://img.shields.io/maven-central/v/{project-group}/{project-name}[Download,link=\"https://search.maven.org/#search|ga|1|{project-name}\"]\nimage:https://img.shields.io/github/license/{project-owner}/{project-name}[\"License\",link=\"https://github.com/{project-owner}/{project-name}\"]\nimage:https://codecov.io/gh/{project-owner}/{project-name}/branch/master/graph/badge.svg[\"Coverage\", link=\"https://codecov.io/gh/{project-owner}/{project-name}\"]\n\nLettuceMod is a Java client for https://redis.io/docs/about/about-stack/[Redis Stack] based on https://lettuce.io[Lettuce].\nIt supports the following Redis Stack features:\n\n* https://redis.io/docs/data-types/json/[JSON data type] (storing, updating, and fetching)\n* https://redis.io/docs/interact/search-and-query/[Search and query] of hashes and JSON documents\n* https://redis.io/docs/data-types/timeseries/[Time series] data support\n* https://redis.io/docs/data-types/probabilistic/[Probabilistic data structures]\n** https://redis.io/docs/data-types/probabilistic/bloom-filter/[Bloom filter]\n** https://redis.io/docs/data-types/probabilistic/cuckoo-filter/[Cuckoo filter]\n** https://redis.io/docs/data-types/probabilistic/t-digest/[t-digest]\n** https://redis.io/docs/data-types/probabilistic/top-k/[Top-K]\n** https://redis.io/docs/data-types/probabilistic/count-min-sketch/[Count-min sketch]\n\n== Getting Started\n\n=== Java\n\n.Maven\n[source,xml,subs=\"verbatim,attributes\"]\n----\n\u003cdependency\u003e\n    \u003cgroupId\u003e{project-group}\u003c/groupId\u003e\n    \u003cartifactId\u003e{project-name}\u003c/artifactId\u003e\n    \u003cversion\u003e{project-version}\u003c/version\u003e\n\u003c/dependency\u003e\n----\n\n.Gradle\n[source,groovy,subs=\"verbatim,attributes\"]\n----\ndependencies {\n    implementation '{project-group}:{project-name}:{project-version}'\n}\n----\n\n=== Spring\n\n.Maven\n[source,xml,subs=\"verbatim,attributes\"]\n----\n\u003cdependency\u003e\n    \u003cgroupId\u003e{project-group}\u003c/groupId\u003e\n    \u003cartifactId\u003elettucemod-spring\u003c/artifactId\u003e\n    \u003cversion\u003e{project-version}\u003c/version\u003e\n\u003c/dependency\u003e\n----\n\n.Gradle\n[source,groovy,subs=\"verbatim,attributes\"]\n----\ndependencies {\n    implementation '{project-group}:lettucemod-spring:{project-version}'\n}\n----\n\n=== Snapshot Releases\n\nFor early-access releases use the following repository:\n\nhttps://s01.oss.sonatype.org/content/repositories/snapshots/\n\n.Maven\n[source,xml]\n----\n\u003crepositories\u003e\n   \u003crepository\u003e\n      \u003cid\u003eoss.sonatype.org-snapshot\u003c/id\u003e\n         \u003curl\u003ehttps://s01.oss.sonatype.org/content/repositories/snapshots\u003c/url\u003e\n         \u003creleases\u003e\n            \u003cenabled\u003efalse\u003c/enabled\u003e\n         \u003c/releases\u003e\n         \u003csnapshots\u003e\n           \u003cenabled\u003etrue\u003c/enabled\u003e\n         \u003c/snapshots\u003e\n   \u003c/repository\u003e\n\u003c/repositories\u003e\n----\n\n.Gradle\n[source,groovy]\n----\nrepositories {\n    maven {\n        url \"https://s01.oss.sonatype.org/content/repositories/snapshots/\"\n    }\n}\n----\n\n== Usage\n\n=== Java\n\n==== Standalone Client\n\n[source,java]\n----\nRedisModulesClient client = RedisModulesClient.create(\"redis://localhost:6379\"); // \u003c1\u003e\nStatefulRedisModulesConnection\u003cString, String\u003e connection = client.connect(); // \u003c2\u003e\nRedisModulesCommands\u003cString, String\u003e commands = connection.sync(); // \u003c3\u003e\n----\n\n\u003c1\u003e Create a modules client\n\u003c2\u003e Connect to Redis server\n\n==== Cluster Client\n\n[source,java]\n----\nList\u003cRedisURI\u003e uris = Arrays.asList(RedisURI.create(\"node1\", 6379), RedisURI.create(\"node2\", 6379)); // \u003c1\u003e\nRedisModulesClusterClient client = RedisModulesClusterClient.create(uris); // \u003c2\u003e\nStatefulRedisModulesClusterConnection\u003cString, String\u003e connection = client.connect(); // \u003c3\u003e\nRedisModulesAdvancedClusterCommands\u003cString, String\u003e commands = connection.sync(); // \u003c4\u003e\n----\n\n\u003c1\u003e Create list of cluster node URIs\n\u003c2\u003e Create a cluster client\n\u003c3\u003e Connect to Redis servers\n\u003c4\u003e Use the sync, async, or reactive API\n\n==== Connection Pool\n\n[source,java]\n----\nGenericObjectPoolConfig\u003cStatefulRedisModulesConnection\u003cString, String\u003e\u003e config = new GenericObjectPoolConfig\u003c\u003e();\nconfig.setMaxTotal(4); // \u003c1\u003e\n// ...\nGenericObjectPool\u003cStatefulRedisModulesConnection\u003cString, String\u003e\u003e pool = ConnectionPoolSupport.createGenericObjectPool(client::connect, config); // \u003c2\u003e\n----\n\n\u003c1\u003e Create a pool configuration\n\u003c2\u003e Create the connection pool\n\n=== Spring\n\n==== Client\n\n[source,java]\n----\n@Component\npublic class MyComponent {\n\n    @Autowired\n    StatefulRedisModulesConnection\u003cString, String\u003e connection;\n\n    // ...\n}\n----\n\n==== Connection Pool\n\n[source,java]\n----\n@Component\npublic class MyComponent {\n\n    @Autowired\n    GenericObjectPool\u003cStatefulRedisModulesConnection\u003cString, String\u003e\u003e pool;\n\n    // ...\n}\n----\n\n=== Commands\n\n[source,java]\n----\nRedisModulesCommands\u003cString, String\u003e commands = connection.sync();\n\n// JSON.SET\ncommands.jsonSet(\"arr\", \".\", \"[1,2,3]\");\n\n// FT.CREATE\ncommands.ftCreate(\"beers\", Field.text(\"name\").build(), Field.numeric(\"ibu\").build());\n\n// FT.SEARCH\ncommands.ftSearch(\"beers\", \"chou*\");\n\n// TS.ADD\ncommands.tsAdd(\"temp:3:11\", Sample.of(1548149181, 30));\n\n// BF.EXISTS\ncommands.bfExists(\"bloom:1\", \"test\");\n\n// CF.EXISTS\ncommands.cfExists(\"cuckoo:1\", \"one\");\n\n// CMS.QUERY\ncommands.cmsQuery(\"cms:1\", \"one\", \"two\", \"three\");\n\n// TDIGEST.RANK\ncommands.tDigestRank(\"tdigest:1\", -5, 100, 5.3);\n\n// TOPK.QUERY\ncommands.topKQuery(\"topk:1\", \"four\", \"three\", \"two\", \"foo\");\n----\n\n\n=== Pipelining\n\n[source,java]\n----\nRedisModulesAsyncCommands\u003cString, String\u003e commands = connection.async();\ncommands.setAutoFlushCommands(false); // \u003c1\u003e\nList\u003cRedisFuture\u003c?\u003e\u003e futures = new ArrayList\u003c\u003e(); // \u003c2\u003e\nfor (MyEntity element : entities()) {\n    futures.add(commands.ftSugadd(\"names\",  Suggestion.of(element.getName(), element.getScore())));\n}\ncommands.flushCommands(); // \u003c3\u003e\nboolean result = LettuceFutures.awaitAll(5, TimeUnit.SECONDS,\n        futures.toArray(new RedisFuture[0])); // \u003c4\u003e\nconnection.close(); // \u003c5\u003e\n----\n\n\u003c1\u003e Disable auto-flushing\n\u003c2\u003e Perform a series of independent calls\n\u003c3\u003e Write all commands to the transport layer\n\u003c4\u003e Synchronization example: Wait until all futures complete\n\u003c5\u003e Later\n\n=== Connection Pooling\n\n[source,java]\n----\nGenericObjectPoolConfig\u003cStatefulRedisModulesConnection\u003cString, String\u003e\u003e config = new GenericObjectPoolConfig\u003c\u003e(); // \u003c1\u003e\nconfig.setMaxTotal(16);\n// ...\nGenericObjectPool\u003cStatefulRedisModulesConnection\u003cString, String\u003e\u003e pool = ConnectionPoolSupport.createGenericObjectPool(client::connect, config); // \u003c2\u003e\ntry (StatefulRedisModulesConnection\u003cString, String\u003e connection = pool.borrowObject()) { // \u003c3\u003e\n    RedisModulesAsyncCommands\u003cString, String\u003e commands = connection.async(); // \u003c4\u003e\n    // ...\n} catch (Exception e) {\n    log.error(\"Could not get a connection from the pool\", e);\n}\n----\n\n\u003c1\u003e Create a pool configuration\n\u003c2\u003e Create the connection pool\n\u003c3\u003e Get connection from pool. Try-with automatically closes connection which returns it to pool\n\u003c4\u003e Use sync, async, or reactive commands\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredis%2Flettucemod","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredis%2Flettucemod","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredis%2Flettucemod/lists"}