public Task PutAsync(string key, object value, Ttl ttl, CancellationToken cancellationToken, bool continueOnCapturedContext) { Put(key, value, ttl); return(TaskHelper.EmptyTask); }
public async Task <InProgress <OracleServer <T, S> > > RegisterOracleAsync <T, S>(ulong queryFee = Constants.BaseConstants.ORACLE_QUERY_FEE, ulong fee = Constants.BaseConstants.FEE, Ttl ttl = default(Ttl), ushort abiVersion = Constants.BaseConstants.ORACLE_VM_VERSION, CancellationToken token = default(CancellationToken)) { ValidatePrivateKey(); string queryformat = SophiaMapper.ClassToOracleFormat <T>(); string responseformat = SophiaMapper.ClassToOracleFormat <S>(); OracleServer <T, S> c = new OracleServer <T, S>(this); Nonce++; await c.SignAndSendAsync(Client.CreateOracleRegisterTransaction(queryformat, responseformat, KeyPair.PublicKey, queryFee, fee, ttl?.Type ?? TTLType.Delta, ttl?.Value ?? Constants.BaseConstants.ORACLE_TTL_VALUE, abiVersion, Nonce, Ttl), token).ConfigureAwait(false); return(new InProgress <OracleServer <T, S> >(new WaitForHash(c), new GetOracle <T, S>())); }
/// <summary> /// Puts the specified value in the cache as part of an asynchronous execution. /// <para><remarks>The implementation is synchronous as there is no advantage to an asynchronous implementation for an in-memory cache.</remarks></para> /// </summary> /// <param name="key">The cache key.</param> /// <param name="value">The value to put into the cache.</param> /// <param name="ttl">The time-to-live for the cache entry.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <param name="continueOnCapturedContext">Whether async calls should continue on a captured synchronization context. <para><remarks>For <see cref="NetStandardIDistributedCacheProvider{TCache}"/>, this parameter is irrelevant and is ignored, as the Microsoft.Extensions.Caching.Distributed.IDistributedCache interface does not support it.</remarks></para></param> /// <returns>A <see cref="Task" /> which completes when the value has been cached.</returns> public abstract Task PutAsync(string key, TCache value, Ttl ttl, CancellationToken cancellationToken, bool continueOnCapturedContext);
/// <summary> /// Puts the specified value in the cache as part of an asynchronous execution. /// <para><remarks>The implementation is synchronous as there is no advantage to an asynchronous implementation for an in-memory cache.</remarks></para> /// </summary> /// <param name="key">The cache key.</param> /// <param name="value">The value to put into the cache.</param> /// <param name="ttl">The time-to-live for the cache entry.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <param name="continueOnCapturedContext">Whether async calls should continue on a captured synchronization context. <para><remarks>For <see cref="MemoryCacheProvider"/>, this parameter is irrelevant and is ignored, as the implementation is synchronous.</remarks></para></param> /// <returns>A <see cref="Task" /> which completes when the value has been cached.</returns> public Task PutAsync(string key, object value, Ttl ttl, CancellationToken cancellationToken, bool continueOnCapturedContext) { cancellationToken.ThrowIfCancellationRequested(); Put(key, value, ttl); return(Task.CompletedTask); }
/// <summary> /// Puts the specified value in the cache. /// </summary> /// <param name="key">The cache key.</param> /// <param name="value">The value to put into the cache.</param> /// <param name="ttl">The time-to-live for the cache entry.</param> public abstract void Put(string key, TCache value, Ttl ttl);
/// <summary> /// Generate the necessary parameters /// </summary> public List <KeyValuePair <string, string> > GetParams() { var p = new List <KeyValuePair <string, string> >(); if (Identity != null) { p.AddRange(Identity.Select(prop => new KeyValuePair <string, string>("Identity", prop))); } if (Tag != null) { p.AddRange(Tag.Select(prop => new KeyValuePair <string, string>("Tag", prop))); } if (Body != null) { p.Add(new KeyValuePair <string, string>("Body", Body)); } if (Priority != null) { p.Add(new KeyValuePair <string, string>("Priority", Priority.ToString())); } if (Ttl != null) { p.Add(new KeyValuePair <string, string>("Ttl", Ttl.ToString())); } if (Title != null) { p.Add(new KeyValuePair <string, string>("Title", Title)); } if (Sound != null) { p.Add(new KeyValuePair <string, string>("Sound", Sound)); } if (Action != null) { p.Add(new KeyValuePair <string, string>("Action", Action)); } if (Data != null) { p.Add(new KeyValuePair <string, string>("Data", Serializers.JsonObject(Data))); } if (Apn != null) { p.Add(new KeyValuePair <string, string>("Apn", Serializers.JsonObject(Apn))); } if (Gcm != null) { p.Add(new KeyValuePair <string, string>("Gcm", Serializers.JsonObject(Gcm))); } if (Sms != null) { p.Add(new KeyValuePair <string, string>("Sms", Serializers.JsonObject(Sms))); } if (FacebookMessenger != null) { p.Add(new KeyValuePair <string, string>("FacebookMessenger", Serializers.JsonObject(FacebookMessenger))); } if (Fcm != null) { p.Add(new KeyValuePair <string, string>("Fcm", Serializers.JsonObject(Fcm))); } if (Segment != null) { p.AddRange(Segment.Select(prop => new KeyValuePair <string, string>("Segment", prop))); } if (Alexa != null) { p.Add(new KeyValuePair <string, string>("Alexa", Serializers.JsonObject(Alexa))); } if (ToBinding != null) { p.AddRange(ToBinding.Select(prop => new KeyValuePair <string, string>("ToBinding", prop))); } return(p); }
public bool Equals(DnsDataResourceRecord other) { return(EqualsBase(other) && Ttl.Equals(other.Ttl) && Data.Equals(other.Data)); }
public void Put(string key, object value, Ttl ttl) { cachedValues[key] = new CacheItem(value, ttl); }
public CacheItem(object value, Ttl ttl) { Expiry = DateTimeOffset.MaxValue - SystemClock.DateTimeOffsetUtcNow() > ttl.Timespan ? SystemClock.DateTimeOffsetUtcNow().Add(ttl.Timespan) : DateTimeOffset.MaxValue; Value = value; }