public IEntryView <K, V> GetEntryView(K key) { var keyData = ToData(key); var request = MapGetEntryViewCodec.EncodeRequest(GetName(), keyData, ThreadUtil.GetThreadId()); var response = Invoke(request, keyData); var parameters = MapGetEntryViewCodec.DecodeResponse(response); var entryView = new SimpleEntryView <K, V>(); var dataEntryView = parameters.dataEntryView; if (dataEntryView == null) { return(null); } entryView.SetKey(ToObject <K>(dataEntryView.GetKey())); entryView.SetValue(ToObject <V>(dataEntryView.GetValue())); entryView.SetCost(dataEntryView.GetCost()); entryView.SetCreationTime(dataEntryView.GetCreationTime()); entryView.SetExpirationTime(dataEntryView.GetExpirationTime()); entryView.SetHits(dataEntryView.GetHits()); entryView.SetLastAccessTime(dataEntryView.GetLastAccessTime()); entryView.SetLastStoredTime(dataEntryView.GetLastStoredTime()); entryView.SetLastUpdateTime(dataEntryView.GetLastUpdateTime()); entryView.SetVersion(dataEntryView.GetVersion()); entryView.SetEvictionCriteriaNumber(dataEntryView.GetEvictionCriteriaNumber()); entryView.SetTtl(dataEntryView.GetTtl()); //TODO putCache return(entryView); }
public static void Encode(SimpleEntryView<IData, IData> dataEntryView, ClientMessage clientMessage) { var key = dataEntryView.GetKey(); var value = dataEntryView.GetValue(); var cost = dataEntryView.GetCost(); var creationTime = dataEntryView.GetCreationTime(); var expirationTime = dataEntryView.GetExpirationTime(); var hits = dataEntryView.GetHits(); var lastAccessTime = dataEntryView.GetLastAccessTime(); var lastStoredTime = dataEntryView.GetLastStoredTime(); var lastUpdateTime = dataEntryView.GetLastUpdateTime(); var version = dataEntryView.GetVersion(); var ttl = dataEntryView.GetTtl(); var evictionCriteriaNumber = dataEntryView.GetEvictionCriteriaNumber(); clientMessage.Set(key) .Set(value) .Set(cost) .Set(creationTime) .Set(expirationTime) .Set(hits) .Set(lastAccessTime) .Set(lastStoredTime) .Set(lastUpdateTime) .Set(version) .Set(evictionCriteriaNumber) .Set(ttl); }
public IEntryView <TKey, TValue> GetEntryView(TKey key) { var keyData = ToData(key); var request = MapGetEntryViewCodec.EncodeRequest(Name, keyData, GetThreadId()); var response = Invoke(request, keyData); var parameters = MapGetEntryViewCodec.DecodeResponse(response); var entryView = new SimpleEntryView <TKey, TValue>(); var dataEntryView = parameters.Response; if (dataEntryView == null) { return(null); } entryView.Key = ToObject <TKey>(((SimpleEntryView)dataEntryView).Key); entryView.Value = ToObject <TValue>(((SimpleEntryView)dataEntryView).Value); entryView.Cost = dataEntryView.Cost; entryView.CreationTime = dataEntryView.CreationTime; entryView.ExpirationTime = dataEntryView.ExpirationTime; entryView.Hits = dataEntryView.Hits; entryView.LastAccessTime = dataEntryView.LastAccessTime; entryView.LastStoredTime = dataEntryView.LastStoredTime; entryView.LastUpdateTime = dataEntryView.LastUpdateTime; entryView.Version = dataEntryView.Version; entryView.EvictionCriteriaNumber = dataEntryView.EvictionCriteriaNumber; entryView.Ttl = dataEntryView.Ttl; //TODO putCache return(entryView); }
public static void Encode(SimpleEntryView <IData, IData> dataEntryView, ClientMessage clientMessage) { var key = dataEntryView.GetKey(); var value = dataEntryView.GetValue(); var cost = dataEntryView.GetCost(); var creationTime = dataEntryView.GetCreationTime(); var expirationTime = dataEntryView.GetExpirationTime(); var hits = dataEntryView.GetHits(); var lastAccessTime = dataEntryView.GetLastAccessTime(); var lastStoredTime = dataEntryView.GetLastStoredTime(); var lastUpdateTime = dataEntryView.GetLastUpdateTime(); var version = dataEntryView.GetVersion(); var ttl = dataEntryView.GetTtl(); var evictionCriteriaNumber = dataEntryView.GetEvictionCriteriaNumber(); clientMessage.Set(key) .Set(value) .Set(cost) .Set(creationTime) .Set(expirationTime) .Set(hits) .Set(lastAccessTime) .Set(lastStoredTime) .Set(lastUpdateTime) .Set(version) .Set(evictionCriteriaNumber) .Set(ttl); }
public static int CalculateDataSize(SimpleEntryView<IData, IData> entryView) { var dataSize = ClientMessage.HeaderSize; var key = entryView.GetKey(); var value = entryView.GetValue(); return dataSize + ParameterUtil.CalculateDataSize(key) + ParameterUtil.CalculateDataSize(value) + Bits.LongSizeInBytes*10; }
public static int CalculateDataSize(SimpleEntryView <IData, IData> entryView) { var dataSize = ClientMessage.HeaderSize; var key = entryView.GetKey(); var value = entryView.GetValue(); return(dataSize + ParameterUtil.CalculateDataSize(key) + ParameterUtil.CalculateDataSize(value) + Bits.LongSizeInBytes * 10); }
public static ResponseParameters DecodeResponse(IClientMessage clientMessage) { var parameters = new ResponseParameters(); SimpleEntryView <IData, IData> dataEntryView = null; var dataEntryView_isNull = clientMessage.GetBoolean(); if (!dataEntryView_isNull) { dataEntryView = EntryViewCodec.Decode(clientMessage); parameters.dataEntryView = dataEntryView; } return(parameters); }
public static SimpleEntryView<IData, IData> Decode(IClientMessage clientMessage) { var dataEntryView = new SimpleEntryView<IData, IData>(); dataEntryView.SetKey(clientMessage.GetData()); dataEntryView.SetValue(clientMessage.GetData()); dataEntryView.SetCost(clientMessage.GetLong()); dataEntryView.SetCreationTime(clientMessage.GetLong()); dataEntryView.SetExpirationTime(clientMessage.GetLong()); dataEntryView.SetHits(clientMessage.GetLong()); dataEntryView.SetLastAccessTime(clientMessage.GetLong()); dataEntryView.SetLastStoredTime(clientMessage.GetLong()); dataEntryView.SetLastUpdateTime(clientMessage.GetLong()); dataEntryView.SetVersion(clientMessage.GetLong()); dataEntryView.SetEvictionCriteriaNumber(clientMessage.GetLong()); dataEntryView.SetTtl(clientMessage.GetLong()); return dataEntryView; }
public static SimpleEntryView <IData, IData> Decode(IClientMessage clientMessage) { var dataEntryView = new SimpleEntryView <IData, IData>(); dataEntryView.SetKey(clientMessage.GetData()); dataEntryView.SetValue(clientMessage.GetData()); dataEntryView.SetCost(clientMessage.GetLong()); dataEntryView.SetCreationTime(clientMessage.GetLong()); dataEntryView.SetExpirationTime(clientMessage.GetLong()); dataEntryView.SetHits(clientMessage.GetLong()); dataEntryView.SetLastAccessTime(clientMessage.GetLong()); dataEntryView.SetLastStoredTime(clientMessage.GetLong()); dataEntryView.SetLastUpdateTime(clientMessage.GetLong()); dataEntryView.SetVersion(clientMessage.GetLong()); dataEntryView.SetEvictionCriteriaNumber(clientMessage.GetLong()); dataEntryView.SetTtl(clientMessage.GetLong()); return(dataEntryView); }