public IEntryProcessorResult ProcessEntry(string key, IEntryProcessor entryProcessor, Object[] arguments, BitSet writeOptionFlag, String defaultWriteThru, OperationContext operationContext) { IEntryProcessorResult result = null; EPCacheEntry epEntry = null; try { epEntry = GetEPCacheEntry(key, entryProcessor.IgnoreLock(), operationContext); object value = null; if (epEntry != null && epEntry.CacheEntry != null) { value = epEntry.CacheEntry.Value; } NCacheMutableEntry mutableEntry = new NCacheMutableEntry(key, value); result = new EntryProcessorResult(key, entryProcessor.ProcessEntry(mutableEntry, arguments)); if (mutableEntry.IsUpdated) { epEntry.CacheEntry = MakeCacheEntry(epEntry.CacheEntry, mutableEntry.Value); UpdateEPCacheEntry(key, epEntry, writeOptionFlag, defaultWriteThru); } else if (mutableEntry.IsRemoved) { RemoveEPCacheEntry(key, epEntry, writeOptionFlag, defaultWriteThru); } } catch (EntryProcessorException ex) { return(new EntryProcessorResult(key, ex)); } catch (Exception ex) { return(new EntryProcessorResult(key, new EntryProcessorException(ex))); } finally { if (epEntry != null && epEntry.LockHandle != null) { try { _cacheRoot.Unlock(key, epEntry.LockHandle.LockId, false, new OperationContext()); } catch (Exception ex) { _context.NCacheLog.Error("EntryProcessorManager.ProcesssEntry", "exception is thrown while unlocking key: " + key.ToString() + ex.Message); } } } return(result); }
public Hashtable ProcessEntries(string[] keys, IEntryProcessor entryProcessor, Object[] arguments, BitSet writeOptionFlag, String defaultWriteThru, OperationContext operationContext) { Hashtable resultMap = new Hashtable(); foreach (string key in keys) { try { IEntryProcessorResult result = this.ProcessEntry(key, entryProcessor, arguments, writeOptionFlag, defaultWriteThru, operationContext); if (result != null) { resultMap.Add(key, result); } } catch (Exception ex) { _context.NCacheLog.Error("Cache.InvokeEntryProcessor", "exception is thrown while processing key: " + key + ex.Message); } } return(resultMap); }