Stone.js API
    Preparing search index...
    • Method decorator: cache the method's result (cache-aside).

      On the first call the method runs and its return value is stored; subsequent calls with the same key return the cached value until it expires. Concurrent cold calls share one execution (stampede protection). If the cache module is not enabled, the method runs normally (graceful no-op).

      Type Parameters

      • T extends Function = Function

      Parameters

      • options: CacheableOptions = {}

        Key/ttl/tags/store options (key defaults to Class.method:<hash(args)>).

      Returns MethodDecorator

      A method decorator.

      class ReportService {
      @Cacheable({ ttl: 300, tags: ['reports'] })
      async monthly (year: number) { return await this.compute(year) }
      }