import NodeCache, { Options } from 'node-cache'; import { Model } from 'mongoose'; import DataRequest from '../utilities/dataQuery'; declare class DataCache { cache: NodeCache; request: DataRequest; constructor(DataModel: Model, cachingOptions: Options); /** * @async * @param data - atleast field _id existed on this parameter * @return {Promise} the document with the id in the parameters */ getItem(id: string): Promise; /** * this method should only be use to fetch small data set * or limit number of data, for example: countries, roles, features and more * @returns {Array} list of all documents fetched */ getAllItems(): Promise; /** * @async * @param {object} doc - is a document object tobe created * @returns {Promise} the object created or null if it was not able to create the document */ createItem(doc: any): Promise; /** * @async * @param {string} id - document id tobe updated * @param {object} doc - fields tobe updated * @returns {Promise} the updated document */ updateItem(id: string, doc: any): Promise; /** * * @param {string} id - the id of the document * @returns {string:null} the id if successfull and null if its not */ deleteItem(id: string): Promise; /** * * @param id - id of the data to remove from cache */ removeCacheData(id: string): void; } export default DataCache;