{"id":15653313,"url":"https://github.com/stefh/distributedcache.azuretablestorage","last_synced_at":"2025-04-30T21:36:40.428Z","repository":{"id":34083638,"uuid":"169728379","full_name":"StefH/DistributedCache.AzureTableStorage","owner":"StefH","description":"IDistributedCache implementation for AzureTableStorage","archived":false,"fork":false,"pushed_at":"2023-05-10T18:31:45.000Z","size":73,"stargazers_count":29,"open_issues_count":2,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-14T13:08:19.026Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/StefH.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":["StefH"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":"https://www.paypal.me/stefheyenrath"}},"created_at":"2019-02-08T11:58:08.000Z","updated_at":"2023-09-16T21:08:37.000Z","dependencies_parsed_at":"2023-01-15T04:32:34.564Z","dependency_job_id":null,"html_url":"https://github.com/StefH/DistributedCache.AzureTableStorage","commit_stats":{"total_commits":37,"total_committers":4,"mean_commits":9.25,"dds":"0.32432432432432434","last_synced_commit":"2502fa8d348b1c1c4c961d52cf0afacc19c596e7"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefH%2FDistributedCache.AzureTableStorage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefH%2FDistributedCache.AzureTableStorage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefH%2FDistributedCache.AzureTableStorage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefH%2FDistributedCache.AzureTableStorage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StefH","download_url":"https://codeload.github.com/StefH/DistributedCache.AzureTableStorage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242710917,"owners_count":20173246,"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":[],"created_at":"2024-10-03T12:45:19.557Z","updated_at":"2025-03-09T15:30:35.536Z","avatar_url":"https://github.com/StefH.png","language":"C#","funding_links":["https://github.com/sponsors/StefH","https://www.paypal.me/stefheyenrath"],"categories":[],"sub_categories":[],"readme":"# ![logo](resources/AzureTableStorage_logo_64x64.png?raw=true) DistributedCache.AzureTableStorage\r\n\r\n* Based on [oceanweb/azuretablestoragecache](https://gitlab.com/oceanweb/azuretablestoragecache) but with lower dependencies.\r\n* Extra added logic to use strongly typed objects with IDistributedCache instead of byte arrays.\r\n* Multiple versions are available, see table below for details.\r\n\r\n## Info\r\n| Version | Dependencies | Information \r\n| :--- | :--- | :---\r\n[![V1](https://img.shields.io/badge/nuget-v1.2.0-blue)](https://www.nuget.org/packages/DistributedCache.AzureTableStorage/1.2.0) | [Windows.Azure.Storage](https://www.nuget.org/packages/WindowsAzure.Storage/) | This dependency is declared deprecated by Microsoft.\r\n[![V2](https://img.shields.io/badge/nuget-v2.1.0-blue)](https://www.nuget.org/packages/DistributedCache.AzureTableStorage/2.1.0) | [Microsoft.Azure.Cosmos.Table](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Table/1.0.7) |\r\n[![V2-preview](https://img.shields.io/badge/nuget-v2.1.0_Preview-blue)](https://www.nuget.org/packages/DistributedCache.AzureTableStorage/2.1.0-preview) | [Microsoft.Azure.Cosmos.Table - Preview](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Table/2.0.0-preview) | This is still a preview version.\r\n[![V3](https://img.shields.io/badge/nuget-v3.3.0-blue)](https://www.nuget.org/packages/DistributedCache.AzureTableStorage) | [Azure.Data.Tables](https://www.nuget.org/packages/Azure.Data.Tables) |\r\n\r\n\r\n## Code example\r\n\r\n### Configure in code (option 1)\r\nc# code:\r\n``` c#\r\n// Configure in code\r\nservices.Configure\u003cAzureTableStorageCacheOptions\u003e(options =\u003e\r\n{\r\n    options.TableName = \"CacheTest\";\r\n    options.PartitionKey = \"ConsoleApp\";\r\n    options.ConnectionString = \"UseDevelopmentStorage=true;\";\r\n    options.ExpiredItemsDeletionInterval = TimeSpan.FromHours(24);\r\n});\r\n```\r\n\r\n### Notes\r\n\r\n- If the TableName does not exists, it's created. If you want to disable this behaviour, set the `options.CreateTableIfNotExists` to `false`.\r\n- When an item is retrieved or added to to the cache, a periodic interval scan can be done to find and delete expired items in the cache. Default this is set to `null`, which means that this functionality is disabled. If you want to change this, set the `options.ExpiredItemsDeletionInterval` to a different value, like `TimeSpan.FromMinutes(30)`.\r\n\r\n### Configure via appsettings.json (option 2)\r\n\r\nappsettings.json:\r\n``` js\r\n\"AzureTableStorageCacheOptions\": {\r\n  \"ConnectionString\": \"UseDevelopmentStorage=true;\",\r\n  \"TableName\": \"CacheTest\",\r\n  \"PartitionKey\": \"ConsoleApp\"\r\n}\r\n```\r\n\r\nc# code:\r\n``` c#\r\n// Configure via app.setttings\r\nservices.Configure\u003cAzureTableStorageCacheOptions\u003e(Configuration.GetSection(\"AzureTableStorageCacheOptions\"));\r\n```\r\n\r\n### Add DistributedAzureTableStorageCache to services\r\n``` c#\r\nservices.AddDistributedAzureTableStorageCache();\r\n```\r\n\r\n### Usage\r\n\r\n``` c#\r\nIDistributedCache cache = ... // injected via DI\r\n\r\nvar test = new TestModel\r\n{\r\n    Id = 1,\r\n    Name = \"Test 1\"\r\n};\r\n\r\n// Set an item in the cache using an expiration from 30 seconds\r\nvar cacheOptions = new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(30) };\r\nawait cache.SetAsync(\"t1\", test, cacheOptions);\r\n\r\n// Retrieve the item from the cache\r\nvar t2 = await cache.GetAsync\u003cTestModel\u003e(\"t1\");\r\nlogger.LogInformation(\"t2 : {TestModel}\", JsonConvert.SerializeObject(t2));\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefh%2Fdistributedcache.azuretablestorage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstefh%2Fdistributedcache.azuretablestorage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefh%2Fdistributedcache.azuretablestorage/lists"}