Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cache deleting automatically even after ttl:false #36

Open
author-sanjay opened this issue Jun 19, 2023 · 0 comments
Open

cache deleting automatically even after ttl:false #36

author-sanjay opened this issue Jun 19, 2023 · 0 comments

Comments

@author-sanjay
Copy link

I did this in my dal layer file
` const cache = new SequelizeSimpleCache({
License: { ttl: false }, // cache for 1 day
}, {
debug: true,
ops: 60, // seconds

});

let checkConnection = async function () {
try {
await sequelize.authenticate();
} catch (error) {
logger.error("Unable to connect to the database:", error);
throw error;
}
}; `

and the function is also in dal layer file only...

let getAllLicenses = async function () { let licenses = await LicenseCache.findAll(); return licenses; };

but. the cache initializes
CACHE INIT { type: 'License', ttl: false, methods: [ 'findOne', 'findAndCountAll', 'findByPk', 'findAll', 'count', 'min', 'max', 'sum', 'find', 'findAndCount', 'findById', 'findByPrimary', 'all' ], methodsUpdate: [ 'create', 'bulkCreate', 'update', 'destroy', 'upsert', 'findOrBuild', 'insertOrUpdate', 'findOrInitialize', 'updateAttributes' ], limit: 50, clearOnUpdate: true, hit: 0, miss: 0, load: 0, purge: 0, ratio: NaN, size: { License: 0 } }

when i first call it it is a miss obviously and then it stores the data in cahce
CACHE OPS { hit: 4, miss: 6, load: 6, purge: 0, ratio: 0.4, size: { License: 6 } }

but then after a few seconds it cleans the cache
CACHE OPS { hit: 0, miss: 0, load: 0, purge: 0, ratio: NaN, size: { License: 0 } }

but ttl is false so cache should not be deleted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant