Skip to content

Util to get key #4

Closed
Closed

Description

@MickL

Describe the feature

Setting the key is easy:

defineCachedFunction(async () => {
    // ...
  },
  {
    getKey: () => 'fancy-key',
  },
);

Will generate something like cache:nitro/functions:_:fancy-key.json. But to invalidate, we have to write the string ourself and hope that it is correct (probably not):

await useStorage('cache').removeItem('cache:nitro/functions:_:fancy-key.json')

Btw. according to the docs there is also no function to get all keys, this would be useful to find a key. E.g. Nitro has: await useStorage('cache').getKeys()

Additional information

  • Would you be willing to help implement this feature?

Activity

  1. added
    enhancement
    on Mar 17, 2026
  2. added a commit that references this issue on Mar 19, 2026
    5123695
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions