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

Values are cached in static fields forever #11

Open
LucGosso opened this issue Jan 14, 2020 · 2 comments
Open

Values are cached in static fields forever #11

LucGosso opened this issue Jan 14, 2020 · 2 comments

Comments

@LucGosso
Copy link

Fargerike has this error.

Since the fields cvlValues and cvls are static, they work as cached for days/weeks/month if not pim is restarted. So the value is empty as the value does not exists.

CVL cvl = CVLs.FirstOrDefault(c => c.Id.Equals(field.FieldType.CVLId));

How would you rebuild it? or solve it?

What about setting a DateTime variable when RemoteManager.ModelService.GetAllCVLValues() was used last time, and then make it configurable to get the values again if time has passed, (for 5,10 or 30 min) ?

@kjetilmk
Copy link
Contributor

Hi, yepp that would work.

Looks like the RemoteManager.ModelService.GetAllCVLs and List GetCVLValuesForCVL(string cvlId) is cached internally in the ModelService. So you could probably rewrite the static List CVLs to use GetAllCVLs and GetCVLValuesForCVL(string cvlId).
With this implementation you wouldn't need a local cache.

@LucGosso
Copy link
Author

LucGosso commented Feb 3, 2020

thx for guidance, yes,

GetAllCVLValues and GetAllCVLs is cached by PIM System setting CVL_VALUE_CACHE_LIFETIME

so this seems to be working:

public List<CVLValue> CVLValues => RemoteManager.ModelService.GetAllCVLValues();//this is cached by PIM System setting CVL_VALUE_CACHE_LIFETIME public List<CVL> CVLs => RemoteManager.ModelService.GetAllCVLs();//this is cached by PIM System setting CVL_VALUE_CACHE_LIFETIME

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

2 participants