Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix for InvalidOperationException in Increment calls that use a cas parameter #4

Merged
merged 1 commit into from

2 participants

@AndrewLane

Possible fix for http://support.couchbase.com/requests/2380
Handle scenario where the object that returns from CasMutate has a null StatusCode property

@AndrewLane AndrewLane Fix Increment call that takes a CAS parameter
Possible fix for http://support.couchbase.com/requests/2380
Handle scenario where the object that returns from CasMutate has a null StatusCode property
4500dc4
@jzablocki jzablocki merged commit 047fc91 into couchbase:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 21, 2012
  1. @AndrewLane

    Fix Increment call that takes a CAS parameter

    AndrewLane authored
    Possible fix for http://support.couchbase.com/requests/2380
    Handle scenario where the object that returns from CasMutate has a null StatusCode property
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 6 deletions.
  1. +6 −6 Enyim.Caching/MemcachedClient.cs
View
12 Enyim.Caching/MemcachedClient.cs
@@ -444,7 +444,7 @@ public ulong Increment(string key, ulong defaultValue, ulong delta, DateTime exp
public CasResult<ulong> Increment(string key, ulong defaultValue, ulong delta, ulong cas)
{
var result = this.CasMutate(MutationMode.Increment, key, defaultValue, delta, 0, cas);
- return new CasResult<ulong> { Cas = result.Cas, Result = result.Value, StatusCode = result.StatusCode.Value };
+ return new CasResult<ulong> { Cas = result.Cas, Result = result.Value, StatusCode = result.StatusCode == null ? default(int) : result.StatusCode.Value };
}
/// <summary>
@@ -460,7 +460,7 @@ public CasResult<ulong> Increment(string key, ulong defaultValue, ulong delta, u
public CasResult<ulong> Increment(string key, ulong defaultValue, ulong delta, TimeSpan validFor, ulong cas)
{
var result = this.CasMutate(MutationMode.Increment, key, defaultValue, delta, MemcachedClient.GetExpiration(validFor, null), cas);
- return new CasResult<ulong> { Cas = result.Cas, Result = result.Value, StatusCode = result.StatusCode.Value };
+ return new CasResult<ulong> { Cas = result.Cas, Result = result.Value, StatusCode = result.StatusCode == null ? default(int) : result.StatusCode.Value };
}
/// <summary>
@@ -476,7 +476,7 @@ public CasResult<ulong> Increment(string key, ulong defaultValue, ulong delta, T
public CasResult<ulong> Increment(string key, ulong defaultValue, ulong delta, DateTime expiresAt, ulong cas)
{
var result = this.CasMutate(MutationMode.Increment, key, defaultValue, delta, MemcachedClient.GetExpiration(null, expiresAt), cas);
- return new CasResult<ulong> { Cas = result.Cas, Result = result.Value, StatusCode = result.StatusCode.Value };
+ return new CasResult<ulong> { Cas = result.Cas, Result = result.Value, StatusCode = result.StatusCode == null ? default(int) : result.StatusCode.Value };
}
#endregion
@@ -534,7 +534,7 @@ public ulong Decrement(string key, ulong defaultValue, ulong delta, DateTime exp
public CasResult<ulong> Decrement(string key, ulong defaultValue, ulong delta, ulong cas)
{
var result = this.CasMutate(MutationMode.Decrement, key, defaultValue, delta, 0, cas);
- return new CasResult<ulong> { Cas = result.Cas, Result = result.Value, StatusCode = result.StatusCode.Value };
+ return new CasResult<ulong> { Cas = result.Cas, Result = result.Value, StatusCode = result.StatusCode == null ? default(int) : result.StatusCode.Value };
}
/// <summary>
@@ -550,7 +550,7 @@ public CasResult<ulong> Decrement(string key, ulong defaultValue, ulong delta, u
public CasResult<ulong> Decrement(string key, ulong defaultValue, ulong delta, TimeSpan validFor, ulong cas)
{
var result = this.CasMutate(MutationMode.Decrement, key, defaultValue, delta, MemcachedClient.GetExpiration(validFor, null), cas);
- return new CasResult<ulong> { Cas = result.Cas, Result = result.Value, StatusCode = result.StatusCode.Value };
+ return new CasResult<ulong> { Cas = result.Cas, Result = result.Value, StatusCode = result.StatusCode == null ? default(int) : result.StatusCode.Value };
}
/// <summary>
@@ -566,7 +566,7 @@ public CasResult<ulong> Decrement(string key, ulong defaultValue, ulong delta, T
public CasResult<ulong> Decrement(string key, ulong defaultValue, ulong delta, DateTime expiresAt, ulong cas)
{
var result = this.CasMutate(MutationMode.Decrement, key, defaultValue, delta, MemcachedClient.GetExpiration(null, expiresAt), cas);
- return new CasResult<ulong> { Cas = result.Cas, Result = result.Value, StatusCode = result.StatusCode.Value };
+ return new CasResult<ulong> { Cas = result.Cas, Result = result.Value, StatusCode = result.StatusCode == null ? default(int) : result.StatusCode.Value };
}
#endregion
Something went wrong with that request. Please try again.