Skip to content

Type Alias: TTL

ts
type TTL = 
  | number
  | {
  days?: number;
  hours?: number;
  minutes?: number;
  seconds?: number;
};

Type representing a time to live (TTL) value, which can be a number or an object with seconds, minutes, hours, or days properties.

Example

ts
const cache5m = new HybridWebCache("CacheDB", {ttl: 300000});
const cache10m = new HybridWebCache("CacheDB", {ttl: { minutes: 10 }});
const cache = new HybridWebCache("CacheDB", {ttl: {hours: 6, days: 1}});