node-cache-manager-sqlite
node-cache-manager-sqlite copied to clipboard
[Bug] store.get is not a function
This error is happend
const cacheCollectionSQLiteStore = cacheManager.caching({
store: sqliteStore,
options: {
serializer: 'json',
ttl: ONE_MINUTE * 60
}
});
async function getCollectionsInfoFromCache() {
const cacheStore = await cacheCollectionStore;
// Launch error
const dataCache = await cacheStore.get('foo');
}
Error image

Node 16.x Strapi v4
I think your problem is
const cacheStore = await cacheCollectionStore;
You don't that line, and I wonder where did you get that line from?
This error is happend
const cacheCollectionSQLiteStore = cacheManager.caching({ store: sqliteStore, options: { serializer: 'json', ttl: ONE_MINUTE * 60 } }); async function getCollectionsInfoFromCache() { const cacheStore = await cacheCollectionStore; // Launch error const dataCache = await cacheStore.get('foo'); }
Error image
![]()
Node 16.x
Strapi v4
I have the same issue using the package.
Please does anyone have a solution?. I'm using nestjs.
I think your problem is
const cacheStore = await cacheCollectionStore;
You don't that line, and I wonder where did you get that line from?
Without the await cacheStore.get() is undefined
because cacheCollectionStore
is a promise and doesn't have the methods resolved yet
I think your problem is
const cacheStore = await cacheCollectionStore;
You don't that line, and I wonder where did you get that line from?
Without the await cacheStore.get() is
undefined
becausecacheCollectionStore
is a promise and doesn't have the methods resolved yet
i have fixed mine.
CacheModule.registerAsync({
isGlobal: true,
useFactory: () => {
const options = {
store: sqliteStore,
name: 'cache',
path: `cache.db`,
};
return caching(options);
},
}),
this worked for me.
I think your problem is
const cacheStore = await cacheCollectionStore;
You don't that line, and I wonder where did you get that line from?
Without the await cacheStore.get() is
undefined
becausecacheCollectionStore
is a promise and doesn't have the methods resolved yeti have fixed mine.
CacheModule.registerAsync({ isGlobal: true, useFactory: () => { const options = { store: sqliteStore, name: 'cache', path: `cache.db`, }; return caching(options); }, }),
this worked for me.
Unfortunately I still have the same problem in Strapi. I guess this code is only for Nestjs?
cacheManager.caching
I have not used strapi, so I have two questions:
- In
cacheManager.caching
is thecacheManager
the cache manager coming fromrequire('cache-manager')
? - If no, what is it?
In case it's standard cache-manager package then:
const cache = cacheManager.caching({
store: sqliteStore,
name: 'employees',
path: '/tmp/cache.db'
})
should give you cache
with get
method you are looking for. What is confusing me is
const cacheStore = await cacheCollectionStore;
Is it part of some new standard I am not aware of?
cacheManager.caching
I have not used strapi, so I have two questions:
- In
cacheManager.caching
is thecacheManager
the cache manager coming fromrequire('cache-manager')
?- If no, what is it?
In case it's standard cache-manager package then:
const cache = cacheManager.caching({ store: sqliteStore, name: 'employees', path: '/tmp/cache.db' })
should give you
cache
withget
method you are looking for. What is confusing me isconst cacheStore = await cacheCollectionStore;
Is it part of some new standard I am not aware of?
This is the complete code.
const cacheCollectionSQLiteStore = cacheManager.caching({
store: sqliteStore,
options: {
serializer: 'json',
ttl: 60 * 60
}
});
const dataCache = await cacheCollectionSQLiteStore.get('key_here');
This is error received. What am I doing wrong?

cacheManager.caching
I have not used strapi, so I have two questions:
- In
cacheManager.caching
is thecacheManager
the cache manager coming fromrequire('cache-manager')
?- If no, what is it?
In case it's standard cache-manager package then:
const cache = cacheManager.caching({ store: sqliteStore, name: 'employees', path: '/tmp/cache.db' })
should give you
cache
withget
method you are looking for. What is confusing me isconst cacheStore = await cacheCollectionStore;
Is it part of some new standard I am not aware of?
This is the complete code.
const cacheCollectionSQLiteStore = cacheManager.caching({ store: sqliteStore, options: { serializer: 'json', ttl: 60 * 60 } }); const dataCache = await cacheCollectionSQLiteStore.get('key_here');
This is error received. What am I doing wrong?
![]()
I think I was not clear enough what is cacheManager
? How was it initialized?
I think I figured out the issue. You are using cache-manager
with v5 or higher. I noticed they have changed everything thing in v5 onwards, which might be causing the issue. I will get package updated and push out a new version with version v5 support.
I think I figured out the issue. You are using
cache-manager
with v5 or higher. I noticed they have changed everything thing in v5 onwards, which might be causing the issue. I will get package updated and push out a new version with version v5 support.
cacheManager is default import from 'cache-manager';
I think I figured out the issue. You are using
cache-manager
with v5 or higher. I noticed they have changed everything thing in v5 onwards, which might be causing the issue. I will get package updated and push out a new version with version v5 support.
I think that's the real problem, thanks for your good job. Blessings!