simple-graphql
Version:
The simple way to generates GraphQL schemas and Sequelize models from your models definition.
22 lines (21 loc) • 741 B
TypeScript
import { SGModel, SGModelCtrl } from '../../index';
import { CountOptions, FindOptions } from 'sequelize';
import { SGCacheManager } from './SGCacheManager';
export default class Cache<M extends SGModel> {
prefix: string;
cacheManger: SGCacheManager;
model: SGModelCtrl;
expire?: number;
constructor(options: {
prefix: string;
cacheManger: SGCacheManager;
model: SGModelCtrl;
expire?: number;
});
private buildCacheKey;
isCacheValid(options?: FindOptions | CountOptions): Promise<boolean>;
findAll(options?: FindOptions): Promise<M[]>;
findOne(options?: FindOptions): Promise<M | null>;
count(options?: CountOptions): Promise<number>;
clear(): Promise<void>;
}