cacheMoviesForCategory method
- CacheCategory category,
- List<
Movie> movies
Cache movies for a specific category.
Implementation
Future<void> cacheMoviesForCategory(
CacheCategory category,
List<Movie> movies,
) async {
await _ensureInitialized();
try {
// Store movies as a list.
await _movieBox!.put(category.value, movies);
// Store timestamp for cache expiration.
await _timestampBox!.put(category.value, DateTime.now());
} catch (e) {
debugPrint('Error caching movies for ${category.value}: $e');
rethrow;
}
}