class CacheUtil {
  static final CacheUtil _instance = CacheUtil._internal();
  static final Map<String, dynamic> _cache = {};

  CacheUtil._internal();

  factory CacheUtil() => _instance;

  static CacheUtil get instance => _instance;

  void set(String key, dynamic value) {
    _cache[key] = value;
  }

  dynamic get(String key) {
    return _cache[key];
  }

  bool containsKey(String key) {
    return _cache.containsKey(key);
  }

  dynamic getOrElse(String key, dynamic fallback) {
    return _cache.containsKey(key) ? _cache[key] : fallback;
  }

  void delete(String key) {
    _cache.remove(key);
  }

  void clear() {
    _cache.clear();
  }
}