sequelize-simple-cache
sequelize-simple-cache copied to clipboard
cache deleting automatically even after ttl:false
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