Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

How can I get a key for a fetch_by_some_attribute([a, b]) if the result is nil?

Open
#456 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
20/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
ruby
Domain
backend

Research direction

Start by reading the README warning about stale data, then trace Model.fetch_by_some_attribute(['green', 'red']) and the IdentityCache.cache.clear(some_key) path. Determine whether nil results should be invalidated or whether callers need a way to obtain the cache key, and define tests that demonstrate the chosen behavior.

Written by the indexing model from the issue text.

Description

So I'm running into stale data issues as per the warning in the readme.
I would like to just invalidate / not even store the result if a fetch_by_some_attribute returns nil.
Failing that, I would like to invalidate the cache by doing IdentityCache.cache.clear(some_key).
But how do I get the key from
Model.fetch_by_some_attribute(['green', 'red'])
if it returns nil?

Dominant language
Ruby
Stars
2k
Forks
175
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Shopify/identity_cache

All issues in Shopify/identity_cache

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.