Skip to content
This repository has been archived by the owner on Jul 7, 2019. It is now read-only.

Commit

Permalink
Use relative expiration for TimeSpans < 30 days.
Browse files Browse the repository at this point in the history
Expirations specified in DateTime or TimeSpans > 30 days will use absolute expirations.
  • Loading branch information
enyim committed Mar 2, 2015
1 parent 2f7ebd3 commit b1cce7d
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 41 deletions.
24 changes: 12 additions & 12 deletions Enyim.Caching/MemcachedClient.Results.cs
Expand Up @@ -42,7 +42,7 @@ public IStoreOperationResult ExecuteStore(StoreMode mode, string key, object val
ulong tmp = 0;
int status;

return this.PerformStore(mode, key, value, MemcachedClient.GetExpiration(validFor, null), ref tmp, out status);
return this.PerformStore(mode, key, value, MemcachedClient.GetExpiration(validFor), ref tmp, out status);
}

/// <summary>
Expand All @@ -58,7 +58,7 @@ public IStoreOperationResult ExecuteStore(StoreMode mode, string key, object val
ulong tmp = 0;
int status;

return this.PerformStore(mode, key, value, MemcachedClient.GetExpiration(null, expiresAt), ref tmp, out status);
return this.PerformStore(mode, key, value, MemcachedClient.GetExpiration(expiresAt), ref tmp, out status);
}

#endregion
Expand Down Expand Up @@ -101,7 +101,7 @@ public IStoreOperationResult ExecuteCas(StoreMode mode, string key, object value
/// <returns>A CasResult object containing the version of the item and the result of the operation (true if the item was successfully stored in the cache; false otherwise).</returns>
public IStoreOperationResult ExecuteCas(StoreMode mode, string key, object value, TimeSpan validFor, ulong cas)
{
return this.PerformStore(mode, key, value, MemcachedClient.GetExpiration(validFor, null), cas);
return this.PerformStore(mode, key, value, MemcachedClient.GetExpiration(validFor), cas);
}

/// <summary>
Expand All @@ -115,7 +115,7 @@ public IStoreOperationResult ExecuteCas(StoreMode mode, string key, object value
/// <returns>A CasResult object containing the version of the item and the result of the operation (true if the item was successfully stored in the cache; false otherwise).</returns>
public IStoreOperationResult ExecuteCas(StoreMode mode, string key, object value, DateTime expiresAt, ulong cas)
{
return this.PerformStore(mode, key, value, MemcachedClient.GetExpiration(null, expiresAt), cas);
return this.PerformStore(mode, key, value, MemcachedClient.GetExpiration(expiresAt), cas);
}
#endregion

Expand Down Expand Up @@ -222,7 +222,7 @@ public IMutateOperationResult ExecuteIncrement(string key, ulong defaultValue, u
/// <remarks>If the client uses the Text protocol, the item must be inserted into the cache before it can be changed. It must be inserted as a <see cref="T:System.String"/>. Moreover the Text protocol only works with <see cref="System.UInt32"/> values, so return value -1 always indicates that the item was not found.</remarks>
public IMutateOperationResult ExecuteIncrement(string key, ulong defaultValue, ulong delta, TimeSpan validFor)
{
return this.PerformMutate(MutationMode.Increment, key, defaultValue, delta, MemcachedClient.GetExpiration(validFor, null));
return this.PerformMutate(MutationMode.Increment, key, defaultValue, delta, MemcachedClient.GetExpiration(validFor));
}

/// <summary>
Expand All @@ -236,7 +236,7 @@ public IMutateOperationResult ExecuteIncrement(string key, ulong defaultValue, u
/// <remarks>If the client uses the Text protocol, the item must be inserted into the cache before it can be changed. It must be inserted as a <see cref="T:System.String"/>. Moreover the Text protocol only works with <see cref="System.UInt32"/> values, so return value -1 always indicates that the item was not found.</remarks>
public IMutateOperationResult ExecuteIncrement(string key, ulong defaultValue, ulong delta, DateTime expiresAt)
{
return this.PerformMutate(MutationMode.Increment, key, defaultValue, delta, MemcachedClient.GetExpiration(null, expiresAt));
return this.PerformMutate(MutationMode.Increment, key, defaultValue, delta, MemcachedClient.GetExpiration(expiresAt));
}

/// <summary>
Expand Down Expand Up @@ -265,7 +265,7 @@ public IMutateOperationResult ExecuteIncrement(string key, ulong defaultValue, u
/// <remarks>If the client uses the Text protocol, the item must be inserted into the cache before it can be changed. It must be inserted as a <see cref="T:System.String"/>. Moreover the Text protocol only works with <see cref="System.UInt32"/> values, so return value -1 always indicates that the item was not found.</remarks>
public IMutateOperationResult ExecuteIncrement(string key, ulong defaultValue, ulong delta, TimeSpan validFor, ulong cas)
{
return this.CasMutate(MutationMode.Increment, key, defaultValue, delta, MemcachedClient.GetExpiration(validFor, null), cas);
return this.CasMutate(MutationMode.Increment, key, defaultValue, delta, MemcachedClient.GetExpiration(validFor), cas);
}

/// <summary>
Expand All @@ -280,7 +280,7 @@ public IMutateOperationResult ExecuteIncrement(string key, ulong defaultValue, u
/// <remarks>If the client uses the Text protocol, the item must be inserted into the cache before it can be changed. It must be inserted as a <see cref="T:System.String"/>. Moreover the Text protocol only works with <see cref="System.UInt32"/> values, so return value -1 always indicates that the item was not found.</remarks>
public IMutateOperationResult ExecuteIncrement(string key, ulong defaultValue, ulong delta, DateTime expiresAt, ulong cas)
{
return this.CasMutate(MutationMode.Increment, key, defaultValue, delta, MemcachedClient.GetExpiration(null, expiresAt), cas);
return this.CasMutate(MutationMode.Increment, key, defaultValue, delta, MemcachedClient.GetExpiration(expiresAt), cas);
}

/// <summary>
Expand All @@ -307,7 +307,7 @@ public IMutateOperationResult ExecuteDecrement(string key, ulong defaultValue, u
/// <remarks>If the client uses the Text protocol, the item must be inserted into the cache before it can be changed. It must be inserted as a <see cref="T:System.String"/>. Moreover the Text protocol only works with <see cref="System.UInt32"/> values, so return value -1 always indicates that the item was not found.</remarks>
public IMutateOperationResult ExecuteDecrement(string key, ulong defaultValue, ulong delta, TimeSpan validFor)
{
return this.PerformMutate(MutationMode.Decrement, key, defaultValue, delta, MemcachedClient.GetExpiration(validFor, null));
return this.PerformMutate(MutationMode.Decrement, key, defaultValue, delta, MemcachedClient.GetExpiration(validFor));
}

/// <summary>
Expand All @@ -321,7 +321,7 @@ public IMutateOperationResult ExecuteDecrement(string key, ulong defaultValue, u
/// <remarks>If the client uses the Text protocol, the item must be inserted into the cache before it can be changed. It must be inserted as a <see cref="T:System.String"/>. Moreover the Text protocol only works with <see cref="System.UInt32"/> values, so return value -1 always indicates that the item was not found.</remarks>
public IMutateOperationResult ExecuteDecrement(string key, ulong defaultValue, ulong delta, DateTime expiresAt)
{
return this.PerformMutate(MutationMode.Decrement, key, defaultValue, delta, MemcachedClient.GetExpiration(null, expiresAt));
return this.PerformMutate(MutationMode.Decrement, key, defaultValue, delta, MemcachedClient.GetExpiration(expiresAt));
}

/// <summary>
Expand Down Expand Up @@ -350,7 +350,7 @@ public IMutateOperationResult ExecuteDecrement(string key, ulong defaultValue, u
/// <remarks>If the client uses the Text protocol, the item must be inserted into the cache before it can be changed. It must be inserted as a <see cref="T:System.String"/>. Moreover the Text protocol only works with <see cref="System.UInt32"/> values, so return value -1 always indicates that the item was not found.</remarks>
public IMutateOperationResult ExecuteDecrement(string key, ulong defaultValue, ulong delta, TimeSpan validFor, ulong cas)
{
return this.CasMutate(MutationMode.Decrement, key, defaultValue, delta, MemcachedClient.GetExpiration(validFor, null), cas);
return this.CasMutate(MutationMode.Decrement, key, defaultValue, delta, MemcachedClient.GetExpiration(validFor), cas);
}

/// <summary>
Expand All @@ -365,7 +365,7 @@ public IMutateOperationResult ExecuteDecrement(string key, ulong defaultValue, u
/// <remarks>If the client uses the Text protocol, the item must be inserted into the cache before it can be changed. It must be inserted as a <see cref="T:System.String"/>. Moreover the Text protocol only works with <see cref="System.UInt32"/> values, so return value -1 always indicates that the item was not found.</remarks>
public IMutateOperationResult ExecuteDecrement(string key, ulong defaultValue, ulong delta, DateTime expiresAt, ulong cas)
{
return this.CasMutate(MutationMode.Decrement, key, defaultValue, delta, MemcachedClient.GetExpiration(null, expiresAt), cas);
return this.CasMutate(MutationMode.Decrement, key, defaultValue, delta, MemcachedClient.GetExpiration(expiresAt), cas);
}
#endregion

Expand Down

0 comments on commit b1cce7d

Please sign in to comment.