cacheResponse method

Future<void> cacheResponse(
  1. String endpoint,
  2. LucidJsonMap response, {
  3. Duration? ttl,
  4. String? version,
})

Implementation

Future<void> cacheResponse(String endpoint, LucidJsonMap response, {Duration? ttl, String? version}) async {
  final key = '$_prefix${endpoint.hashCode}${version != null ? '_$version' : ''}';
  await _manager.putJson(key, {
    'data': response,
    'cachedAt': DateTime.now().toIso8601String(),
    'endpoint': endpoint,
    'version': version,
  }, ttl: ttl ?? _defaultTtl);
}