I see: `NormalizedCache.remove(pattern: String)` i...
# apollo-kotlin
j
I see:
NormalizedCache.remove(pattern: String)
is removed. Which is kind of ok, but it would be nice to have a convenience to remove all cache keys associated with a specific type (or cache key scope?), which assuming type was prefixed in the cache keys, was easy to do with this function
b
Good feedback! May I ask what's your use case?
j
The way we use it today maybe is too imperative, but we have some situations that rely on it where redeeming something of a specific entity type invalidates the other copy(s) of that entity type.
Maybe in our situation field/type merge policies could be more effective
b
Could
removeUnreachableRecords()
work for this?
j
that or the policies should be enough. makes sense to push more towards that concept
b
I'm actually not sure of what you mean by the policies to handle that case 🙂 (great if that's a solution though!)
j
our service has a query modeled with edges, but we only ever want one edge in our client. we were clearing out the types that previously existed before fetching in some cases when it was invalid. In this situation I think itll still match so could be considered reachable. but a merge policy that when 'merging' only takes the new content might be a better fit
b
Hmm I see. Well please don't hesitate to follow up if that works for you or doesn't - if adding the ability to remove records per type is useful we can certainly add it. We even had this ticket but weren't sure of a use case - but can revisit.
👍 1