Stone.js API
    Preparing search index...
    • Method decorator: always run the method, then write its result to the cache.

      Unlike @Cacheable (which short-circuits on a hit), @CachePut executes every time and refreshes the cached value, keeping the cache warm and consistent after a write. If the cache module is not enabled, the method runs normally (graceful no-op).

      Type Parameters

      • T extends Function = Function

      Parameters

      Returns MethodDecorator

      A method decorator.

      class UserService {
      @CachePut({ key: (id) => `user:${id}`, ttl: 600 })
      async update (id: string, data: object) { return await this.save(id, data) }
      }