Skip to content

Comments

First time generation number is requested return 1 without save gener…#221

Open
tresoldigiorgio wants to merge 2 commits intoSharpRepository:developfrom
tresoldigiorgio:develop
Open

First time generation number is requested return 1 without save gener…#221
tresoldigiorgio wants to merge 2 commits intoSharpRepository:developfrom
tresoldigiorgio:develop

Conversation

@tresoldigiorgio
Copy link
Contributor

…ation cache key in cache

@omarpiani
Copy link
Member

As known we need to unit test.

@jtreuting , what is this Generational parameter in caching? is there some documentation somewhere? seems a nonsense that is not updated in many cases.

@jtreuting
Copy link
Member

Here is some more info about the generational caching: http://fairwaytech.com/2012/09/write-through-and-generational-caching/

Essentially, there is a shared generation number that is used as part of the cache key. Instead of needing to keep track of what is cached in order to flush only those specific things when needed, when there is an update to the DB the generation number gets incremented and therefore expires the old cached data that used the previous number.

if (!CachingProvider.Get(GetGenerationKey(), out int generation))
{
IncrementGeneration();
return GetGeneration();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couldn't this be simplified to return IncrementGeneration(); since it returns what that key is there shouldn't be a need to ask for it again.

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

Successfully merging this pull request may close these issues.

3 participants