Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MonkeyCache.FileStore Add with expireIn = TimeSpan.MaxValue is not working #76

Open
JMan7777 opened this issue Jan 14, 2020 · 4 comments

Comments

@JMan7777
Copy link

Hello,

If using MonkeyCache.FileStore and if you try to write a "permanent" entry to the cache e.g.

Barrel.Current.Add("MyKey", "MyData", TimeSpan.MaxValue);

an entry is written to the cache but the value is always null.

At the moment I'm using an ugly workaround but this is no real solution:

public void Add<T>(string key, T data, TimeSpan expireIn, string eTag = null, JsonSerializerSettings jsonSerializationSettings = null) { lock (padlock) { if (expireIn != null && expireIn.Equals(TimeSpan.MaxValue)) { expireIn = TimeSpan.FromDays(3650); //10 years should be enough ;) } Barrel.Current.Add(key, data, expireIn, eTag, jsonSerializationSettings); } }

Thx a lot.

Markus

@jamesmontemagno
Copy link
Owner

What platform are you seeing an issue on? I have a unit test in place so shouldnt' be an issue.

@JMan7777
Copy link
Author

Hi,

Platform is Xamarin for Android (latest version).
Development IDE is Visual Studio 2019 Version 16.4.4.
App is build for:
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29" />

Thx for your help.

@jamesmontemagno
Copy link
Owner

Will give it a test thanks

@marcoregueira
Copy link

Thanks @JMan7777 for the tip, it was driving me crazy. A 10 year span seems ok to use but a hundred, for instance, makes it fail.

It still happens in current v3 prerelease.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants