public static bool IsCacheContainsKey(this GameObject self, string key) { CacheMonoBehaviour cache = self.GetOrAddComponent <CacheMonoBehaviour>(); return(cache.dict.ContainsKey(key)); }
public static T GetCache <T>(this GameObject self, string key, string subKey) { CacheMonoBehaviour cache = self.GetOrAddComponent <CacheMonoBehaviour>(); return(cache.Get <T>(key, subKey)); }
public static T GetOrAddCache <T>(this GameObject self, string key, string subKey, Func <T> defaultFunc) { CacheMonoBehaviour cache = self.GetOrAddComponent <CacheMonoBehaviour>(); return(cache.GetOrAdd(key, subKey, defaultFunc)); }
public static void SetCache(this GameObject self, string key, string subKey, object obj) { CacheMonoBehaviour cache = self.GetOrAddComponent <CacheMonoBehaviour>(); cache.Set(obj, key, subKey); }