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

Use cacheKey of id supplied to SimpleFetcherCache::clearId #443

Merged
merged 2 commits into from
Jun 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class SimpleFetcherCache extends FetcherCache {
}

override def clearId(id: Any) =
cache.remove(id)
cache.remove(cacheKey(id))

override def clearRel(rel: Any) =
relCache.removeKeys {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,16 @@ class FetcherSpec extends AnyWordSpec with Matchers with FutureResultSupport {
Vector("5", "6", "7")))
}

"clearId should remove entry from cache" in {
val cache = new SimpleFetcherCache() {
override def cacheKey(id: Any): Any = id.toString
}
cache.update(1, "one")
cache.get(1) should be(Some("one"))
cache.clearId(1)
cache.get(1) should be(None)
}

"support multiple fetchers" in {
var fetchedCatIds = Vector.empty[Seq[String]]

Expand Down