{"id":22843527,"url":"https://github.com/craigwardman/chunkingredisclient","last_synced_at":"2025-08-19T02:34:43.152Z","repository":{"id":38011549,"uuid":"164406169","full_name":"craigwardman/ChunkingRedisClient","owner":"craigwardman","description":"A C# library which implements various wrappers around the StackExchange.Redis client, specifically using Newtonsoft.Json serialisation; Such as streamed reading/writing and sliding expiration.","archived":false,"fork":false,"pushed_at":"2022-06-23T13:27:32.000Z","size":37,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-29T18:17:04.747Z","etag":null,"topics":["chunking","csharp","extensions","json","net-core","newtonsoft-json","redis","redis-client","stackexchange-redis","wrapper-library"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/craigwardman.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":"2019-01-07T09:07:26.000Z","updated_at":"2022-06-23T11:20:14.000Z","dependencies_parsed_at":"2022-08-28T02:41:55.466Z","dependency_job_id":null,"html_url":"https://github.com/craigwardman/ChunkingRedisClient","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/craigwardman/ChunkingRedisClient","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigwardman%2FChunkingRedisClient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigwardman%2FChunkingRedisClient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigwardman%2FChunkingRedisClient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigwardman%2FChunkingRedisClient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/craigwardman","download_url":"https://codeload.github.com/craigwardman/ChunkingRedisClient/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigwardman%2FChunkingRedisClient/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263233563,"owners_count":23434880,"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":["chunking","csharp","extensions","json","net-core","newtonsoft-json","redis","redis-client","stackexchange-redis","wrapper-library"],"created_at":"2024-12-13T02:15:32.543Z","updated_at":"2025-07-02T23:33:32.106Z","avatar_url":"https://github.com/craigwardman.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chunking Redis Client\nA C#/.NET Core library which wraps the StackExchange.Redis client, specifically using JSON serialisation, and adds functionality such as chunked reading/writing and sliding expiration.\n\nTo install without the source, use the NuGet package:\nhttps://www.nuget.org/packages/ChunkingRedisClient/\n\nThe purpose of this library is to create a re-usable library of code for wrapping the StackExchange.RedisClient and solving the issues I usually need to solve.\n\nThose being:\n\n* IoC wrappers/abstractions\u003cbr/\u003e\n   - Just take your dependency on `IRedisClient\u003cTKey, TItem\u003e`\u003cbr/\u003e\n   - By default you should configure your DI container to inject the provided RedisClient\u003cTKey, TItem\u003e\u003cbr/\u003e\n   - Since IoC is used throughout you also need to configure:\u003cbr/\u003e\n     ~ `IRedisWriter\u003cTKey, Item\u003e` -\u003e JsonRedisWriter or ChunkedJsonRedisWriter\u003cbr/\u003e\n     ~ `IRedisReader\u003cTKey, Item\u003e` -\u003e JsonRedisReader or ChunkedJsonRedisReader\u003cbr/\u003e\n     ~ `IRedisWriter\u003cTKey, Item\u003e` -\u003e JsonRedisDeleter or ChunkedJsonRedisDeleter\u003cbr/\u003e\n     (note: for one combination of TKey, TItem - ensure the decision to chunk or not is consistent)\u003cbr/\u003e\n     ~ `IKeygen\u003cTKey\u003e` to an object specific implementation, like GuidKeygen\u003cbr/\u003e\n     ~ For chunking, locking is required:\u003cbr/\u003e\n             IRedisLockFactory -\u003e RedisLockFactory\u003cbr/\u003e\n             To override the default of InMemoryRedisLock, call `RedisLockFactory.Use\u003cIRedisLock\u003e() \u003c-- your class here`\u003cbr/\u003e\n     \n* Strongly typed access to the cache\u003cbr/\u003e\n  - Use any C# object as your TKey and TItem, given that:\u003cbr/\u003e\n      ~ You can implement your own Keygen for TKey\u003cbr/\u003e\n      ~ Your TItem is serialisable by Newtonsoft.Json\u003cbr/\u003e\n      \n* Implementing the StackExchange Connection Multiplexer\u003cbr/\u003e\n  - This is handled by the RedisDatabaseFactory\u003cbr/\u003e\n  - Not using the usual `Lazy\u003cConnectionMulitplexer\u003e` approach, as I want to support one multiplexer per connection string (if your app is dealing with more than 1 cache)\u003cbr/\u003e\n  - The multiplexers are stored in a concurrent dictionary where the connection string is the key\u003cbr/\u003e\n  - The multiplexer begins connecting asynchronously on first use\u003cbr/\u003e\n    \n* Sliding expiration of cache keys\u003cbr/\u003e\n  - Pass in the optional timespan to read methods if you want to use sliding expiration\u003cbr/\u003e\n  - This updates the expiry when you read the item, so that keys which are still in use for read purposes live longer\u003cbr/\u003e\n  \n* Chunked JSON data\u003cbr/\u003e\n  - This solves a performance issue whereby Redis does not perform well with large payloads.\u003cbr/\u003e\n  - Sometimes you may also have had errors from the server when the queue is full.\u003cbr/\u003e\n  - The default chunk size is 10KB which can be configured in the ChunkedJsonRedisWriter\u003cbr/\u003e\n  - The JSON data is streamed from Newtonsoft into a buffer. Every time the buffer is full it is written to Redis under the main cache key with a suffix of \"chunkIndex\"\u003cbr/\u003e\n  - The main cache key is then written to contain the count of chunks, which is used by the reader and deleter.\u003cbr/\u003e\n  \n* Generating keys for objects\u003cbr/\u003e\n  - I don't like using bytes for keys as they are not human readable, so I like to generate unique strings\u003cbr/\u003e\n  - There is no none-intrusive way of providing a type agnostic generic keygen, therefore you must write your own. If you write something for a CLR type, considering contributing it to the project!\n  - Since we know Guids are unique, I have demonstrated the ability to create custom keygens.\u003cbr/\u003e\n\n\nThe code can be extended to support other serialisation types (TODO), distributed locks (TODO), different ways of generating keys or whatever you need it to do.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraigwardman%2Fchunkingredisclient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcraigwardman%2Fchunkingredisclient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraigwardman%2Fchunkingredisclient/lists"}