{"id":29112139,"url":"https://github.com/cdwaddell/aspcachemanager","last_synced_at":"2025-06-29T10:04:57.798Z","repository":{"id":116498259,"uuid":"103001391","full_name":"cdwaddell/AspCacheManager","owner":"cdwaddell","description":"AspCacheManager is a dotnet Standard 2.0 library for creating a cache management strategy. This package allows you to prehydrate cache, and proactively rehydrate cached items, so your users never have to wait for an expired cache item to rehydrate with updated data.","archived":false,"fork":false,"pushed_at":"2017-09-11T19:57:42.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-29T10:04:47.277Z","etag":null,"topics":["cache-control","dotnet-standard","nuget-package"],"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/cdwaddell.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-10T03:43:51.000Z","updated_at":"2017-09-10T03:46:34.000Z","dependencies_parsed_at":"2023-04-21T17:18:16.883Z","dependency_job_id":null,"html_url":"https://github.com/cdwaddell/AspCacheManager","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cdwaddell/AspCacheManager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdwaddell%2FAspCacheManager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdwaddell%2FAspCacheManager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdwaddell%2FAspCacheManager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdwaddell%2FAspCacheManager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cdwaddell","download_url":"https://codeload.github.com/cdwaddell/AspCacheManager/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdwaddell%2FAspCacheManager/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262574121,"owners_count":23330779,"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-control","dotnet-standard","nuget-package"],"created_at":"2025-06-29T10:04:46.338Z","updated_at":"2025-06-29T10:04:57.767Z","avatar_url":"https://github.com/cdwaddell.png","language":"C#","readme":"# Titanosoft.AspCacheManager\n\n![Build Status](https://cdanielwaddell.visualstudio.com/_apis/public/build/definitions/991b95e6-1640-4127-b933-3b0aaddb919b/8/badge)\n\n### What is AspCacheManager?\n\nAspCacheManager is a dotnet Standard 2.0 library for creating a cache management strategy. This package allows you to prehydrate cache, and proactively rehydrate cached items, so your users never have to wait for an expired cache item to rehydrate with updated data.\n\n### How do I get started?\n\nFirst install the nuget package:\n\n```\nPM\u003e Install-Package Titanosoft.AspCacheManager\n```\n\nOnce installed, you need to register the module in your ConfigureServices method:\n\n```csharp\npublic class Startup\n{\n    public void ConfigureServices(IServiceCollection services)\n    {\n        ...\n        var migrationsAssembly = typeof(ServiceExtensions).GetTypeInfo().Assembly.GetName().Name;\n\n        //services.AddDbContext\u003cMyCustomDbContext\u003e();\n        //services.AddTransient\u003cMyExpirationService\u003e();\n        services.AddTransient\u003cSomeOtherProject.MyCacheClass\u003e();\n\n        services\n            //Add cache management\n            .AddCacheManager()\n\n            //register a class that determines when cache should be forced to expire\n            //Option 1 - Accept add defaults (even connection string)\n            .AddEfExpirationService()\n\n            ////Option 2 - Change the connection string\n            //.AddEfExpirationService(\"MyConnectionString\")\n\n            ////Option 3 - If you want more control\n            //.AddEfExpirationService(x =\u003e\n            //    x.UseSqlServer(connectionString, options =\u003e\n            //        options.MigrationsAssembly(migrationsAssembly)\n            //    )\n            //)\n\n            ////Option 4 - If you created your own context that implements from ICacheExpirationContext\n            ////NOTE: MyCustomDbContext needs to already be registered with the DI container\n            ////NOTE 2: You will have to manually handle migrations of your own context\n            //.AddCustomEfExpirationService\u003cMyCustomDbContext\u003e\n\n            ////Option 5 - If you want custom logic and/or no database envolved\n            ////NOTE: MyExpirationService needs to already be registered with the DI container\n            //AddCustomExpirationService\u003cMyExpirationService\u003e)\n\n            //Manually register a custom cache item\n            ////NOTE: SomeOtherProject.MyCacheClass needs to already be registered with the DI container\n            .AddCustomCache\u003cSomeOtherProject.MyCacheClass\u003e()\n            //--And/Or--\n            //Autoscan an assembly for cache instances\n            .AddCacheClasses(typeof(Startup).GetTypeInfo().Assembly)\n    }\n    ...\n}\n```\n\nThen, you need to configure the module to scan for cache expirations in the Confgure method:\n\n```csharp\npublic void Configure(IApplicationBuilder app)\n{\n    ...\n    //Register a background job to monitor cache items for you\n    app.UseCacheManager()\n        //If you used AddEfExpirationService to register and enabled migrations (on by default)\n        //you can have the application auto apply migrations\n        .CheckMigrations();\n    ...\n}\n```\n\n### What if I want to use your context, but don't want to give full db access to the user?\n\nDon't worry, you don't have to. You can just give full schema access. Use the following sql script to create the user for the connection given to the configuration connection string. This will isolate your other schemas from being affected by the library:\n\n```sql\nCREATE USER [AspCacheManager] WITH PASSWORD = 'strong_password_for_config'\nGO\n\nIF NOT EXISTS (SELECT 1 FROM sys.schemas WHERE [name] = 'cache') EXEC ('CREATE SCHEMA [cache]')\nGO\n\nALTER AUTHORIZATION ON SCHEMA::[cache] TO [AspCacheManager]\nGO\n\nGRANT CREATE TABLE TO [AspCacheManager]\nGO\n```\n\n### What if I want to use your context, but I don't want to automigrate at all?\n\nYou also don't have to do this, but it is a little more work. Inside of the nuget package is a \"tools\" folder. In that folder is a \"Migrations.sql\" file. If you retreive that file and run it as part of your deployment, your database will always be up to date. Note: the user running the deployment script will have to have the above access.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdwaddell%2Faspcachemanager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdwaddell%2Faspcachemanager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdwaddell%2Faspcachemanager/lists"}