UNPKG

@jbagatta/johnny-cache

Version:

A robust distributed dictionary for coordinating and caching expensive operations in a distributed environment

39 lines (38 loc) 1.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OrmDataStore = void 0; // TODO Implement // Database data store is not really a cache - should probably not support expiry // Support TypeOrm, Sequelize and Prisma too - need ORM abstraction layer class OrmDataStore { async tryReserve(key, reservationExpiryMs) { // use unique constraint on key, try to insert // can time out the lock using created date + reservationExpiryMs return null; } async has(key) { // select where key = key return null; } async get(key) { // select where key = key return null; } async tryUpdateReservation(key, buildId, result, expiry) { // update where key = key, verify buildId matches // expiry not supported in DB return null; } async delete(key) { // delete where key = key return null; } async updateExpiry(key, expiry) { // expiry not supported in DB return null; } async close() { return null; } } exports.OrmDataStore = OrmDataStore;