/// <summary> /// Reset registered Cache /// </summary> /// <param name="tableName">table name</param> /// <param name="Record_ID">record if applicable or 0 for all</param> /// <returns>number of deleted cache entries</returns> public int Reset(String tableName, int Record_ID) { if (tableName == null) { return(Reset()); } // if (tableName.endsWith("Set")) // tableName = tableName.substring(0, tableName.length()-3); if (!tableNames.Contains(tableName)) { return(0); } // int counter = 0; int total = 0; for (int i = 0; i < instances.Count; i++) { ICacheInterface stored = (ICacheInterface)instances[i]; //if (stored != null && stored.GetType().ToString() == "VAdvantage.Classes.CCache") if (stored != null && stored.GetType().ToString().Contains("VAdvantage.Classes.CCache")) { //CCache cc = (CCache)stored; //if (cc.GetName().StartsWith(tableName)) if (stored.GetName().StartsWith(tableName)) // reset lines/dependent too { // if (Record_ID == 0) { log.Fine("(all) - " + stored); total += stored.Reset(); counter++; } } } } log.Info(tableName + ": #" + counter + " (" + total + ")"); // Update Server //if (DataBase.isRemoteObjects()) //{ // Server server = CConnection.get().getServer(); // try // { // if (server != null) // { // See ServerBean // int serverTotal = server.cacheReset(tableName, 0); //int serverTotal = CacheReset(tableName, 0); // if (CLogMgt.isLevelFinest()) // { // log.Fine("Server => " + serverTotal); // } // } // } // catch (RemoteException ex) // { // log.Log(Level.SEVERE, "AppsServer error", ex); // } //} return(total); }
public bool IsExistAsset(AssetId asset_id, AssetType type) { ICacheInterface cache = this.GetCache(type); if (null == cache) { return(false); } return(cache.IsExistAsset(asset_id)); }
public void AddAssetItem(AssetItem asset) { ICacheInterface cache = this.GetCache(asset.type); if (null == cache) { return; } cache.AddAssetItem(asset); }
public AssetItem GetAssetItem(AssetId asset_id, AssetType type) { ICacheInterface cache = this.GetCache(type); if (null == cache) { return(null); } return(cache.GetAssetItem(asset_id)); }
public bool Register(ICacheInterface instance) { if (instance == null) { return(false); } //if(instance.GetType().ToString() == "VAdvantage.Classes.CCache") if (instance.GetType().ToString().Contains("VAdvantage.Classes.CCache")) { String tableName = instance.GetName(); //String tableName = ((CCache)instance).GetName(); tableNames.Add(tableName); } instances.Add(instance); return(true); }
/// <summary> /// Reset All registered Cache /// </summary> /// <returns>number of deleted cache entries</returns> public int Reset() { int counter = 0; int total = 0; for (int i = 0; i < instances.Count; i++) { ICacheInterface stored = (ICacheInterface)instances[i]; if (stored != null && stored.Size() > 0) { log.Fine(stored.ToString()); total += stored.Reset(); counter++; } } log.Info("#" + counter + " (" + total + ")"); return(total); }
/// <summary> /// Un-Register Cache Instance /// </summary> /// <param name="instance">Cache</param> /// <returns>true if removed</returns> public bool UnRegister(ICacheInterface instance) { if (instance == null) { return(false); } bool found = false; // Could be included multiple times for (int i = instances.Count - 1; i >= 0; i--) { ICacheInterface stored = (ICacheInterface)instances[i]; if (instance.Equals(stored)) { instances.RemoveAt(i); found = true; } } return(found); }
//@SuppressWarnings("unchecked") /// <summary> /// Total Cached Elements /// </summary> /// <returns>count</returns> public int GetElementCount() { int total = 0; for (int i = 0; i < instances.Count; i++) { ICacheInterface stored = (ICacheInterface)instances[i]; if (stored != null && stored.Size() > 0) { log.Fine(stored.ToString()); //if(stored.GetType().ToString() == "VAdvantage.Classes.CCache") if (stored != null && stored.GetType().ToString().Contains("VAdvantage.Classes.CCache")) { //total += ((CCache)stored).sizeNoExpire(); total += stored.SizeNoExpire(); } else { total += stored.Size(); } } } return(total); }
public HackerController(ICacheInterface <Story> memCache, IApiClientInterface client) { _HackerCacheCache = memCache; _Httpclient = client; }