# extendify/0.10.2/src/Onboarding/hooks/useCache.js

Extendify, version 0.10.2. 12 lines.

- Page: https://pluginprobe.com/plugins/extendify/0.10.2/code/src/Onboarding/hooks/useCache.js
- Raw: https://pluginprobe.com/plugins/extendify/0.10.2/raw/src/Onboarding/hooks/useCache.js
- Modified: 2022-05-27T00:51:26+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/extendify/0.10.2/code/src/Onboarding/hooks/useCache.js#L10-L20`.

```javascript
import { useSWRConfig } from 'swr'

export const useCache = () => {
    const { cache } = useSWRConfig()
    return (keyToMatch) => cache.get(findKey(keyToMatch, cache))
}
const findKey = (partial, map) => {
    for (const key of map.keys()) {
        if (key.match(partial)) return key
    }
}

```
