FileCachingLayer does not restore the saved data file even if the application is restarted. Manifest file empty.
See original GitHub issueWhat does the bug do?
Although it saves the json file of the data generated with FileCachingLayer (JsonFileCacheLayer) in the folder, it does not write its metadata to the manifest file. When the application is restarted, although the data file exists, it does not pull the cached data and calls it from the getter again.
How can it be reproduced?
// Startup.cs
services.AddCacheStack(
new ICacheLayer[]
{
//new MemoryCacheLayer(),
new JsonFileCacheLayer(@"D:\jsoncachelayer")
},
new[] {
new AutoCleanupExtension(TimeSpan.FromMinutes(30))
});
// Controller.cs
public async Task<IActionResult> IndexAsync()
{
var model = await _cacheStack.GetOrSetAsync<IndexViewModel>($"indexviewmodel", async (old) =>
{
return await _lnwCache.GetHomepageIndexModel();
}, new CacheSettings(TimeSpan.FromMinutes(15)));
return View("Index", model);
}
// manifest.json
{"Value":{}}
The file containing the data is stored in the folder named A1303B032BB63284F6F595600591AA13.json. But the manifest file is empty.
P.S: Read and write permissions are defined to the folder.
- NuGet Package Version: 0.11.2
- .NET Runtime Version: .NET 5
- Operating System: Windows 10
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
No Saved Data Exists : r/MHRise
When I'm met with a Message telling me that "No Saved Data Exists. ... Is there a way to get my save file...
Read more >The original file 'AndroidManifest.xml' has been deleted or ...
If you've deleted the file, you'll find it in history. ... go to your workspace->your project folder and see if there is a...
Read more >possible corruption in the MANIFEST file?
The fix assumes that if the reopen of the manifest file fails, then everything is fine and life continues. But this is incorrect,...
Read more >How to Restore Game Save Data on PS5 & Fix Lost Single ...
If your a PS Plus member, your game save data should auto upload to ... Now go to the setting section, then go...
Read more >take photo and save to Album,but error - Microsoft Q&A
I use the codes to take photo and save it. private async void btnCamera_Clicked(object sender, EventArgs e) { var photo = await CrossMedia....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yep, the DI system had this as intended behaviour so Cache Tower was just using it wrong. I’ve updated the service collection extensions to resolve this issue (allowing the cache stack and its layers to dispose, allowing the manifest to save).
I’ve just released v0.11.3 which includes the fix to the service collection/dependency injection so it should be disposed now (and thus trigger the manifest to save).
Let me know if it is still a problem after you’ve updated!
Glad it is all working now!
That’s an interesting idea - I’ve created #189 to track it. From what I’m picturing at the moment, it will likely need to take in the time-to-live value otherwise it can’t save the refreshed value in the cache. The method will likely need to be async too as background refreshing kinda cheats by simply not awaiting internally on an action.