Trying to use memcache's increment function in VB.NET. It won't increment a darn thing and returns -1 as the result when trying to use the increment function. Always says message counter incremented from 1. Value is now 1
Here's my sub as it stands. First run it adds, then subsequent runs it should use increment and print the value to screen.
Dim msgCounter As String
Dim cacheKey As String = "testkey01"
msgCounter = DistCache.Get(cacheKey)
If String.IsNullOrEmpty(msgCounter) Then
DistCache.Add(cacheKey, 1, TimeSpan.FromMinutes(5))
msgCounter = "message counter was 0"
Else
Label2.Text = DistCache.Increment(cacheKey, 1)
msgCounter = "message counter incremented from " & msgCounter & ". Value is now " & DistCache.Get(cacheKey)
End If
lab1.Text = msgCounter