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

Selective Flushing on Writes #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Selective Flushing on Writes #4

wants to merge 3 commits into from

Conversation

eytan-avisror
Copy link
Contributor

@eytan-avisror eytan-avisror commented Jan 18, 2020

Currently, when a write is made, it will flush all service caches.
For example, a call to elasticloadbalancing.DescribeTargetHealth will cache, and a subsequent call to elasticloadbalancing.DeregisterTarget (an non-cacheable write) would flush all caches under elasticloadbalancing.

This behavior might be inappropriate if the write is irrelevant to other reads.
In the above case for example, I do not want DeregisterTargets to flush all my caches for elasticloadbalancing.

This is further relevant when considering that elb and elbv2 are both using service name elasticloadbalancing.

This PR adds a map of mutatingCaches which can define which write operations are mutating and we should flush when they are called.

By default, all writes are considered mutating (to have same behavior as now), however one could choose to exclude a specific operation from this behavior by using SetCacheMutating(serviceName, operationName, false) => this will mark the specific operation as non-mutating.
In this case we will only flush the operation cache i.e. discard that write cache instead of flushing all service caches

This can really improve cache hit/miss in some scenarios.

@coveralls
Copy link

coveralls commented Jan 18, 2020

Pull Request Test Coverage Report for Build 33

  • 29 of 31 (93.55%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+2.8%) to 72.596%

Changes Missing Coverage Covered Lines Changed/Added Lines %
cache/config.go 29 31 93.55%
Totals Coverage Status
Change from base Build 31: 2.8%
Covered Lines: 151
Relevant Lines: 208

💛 - Coveralls

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.

None yet

2 participants