0
嘗試在VB.NET中使用memcache的增量函數。在嘗試使用增量函數時,它不會增加一個補碼並返回-1。總是說消息計數器從1遞增。現在的值爲1VB.NET memcache增量問題
這是我的子代。首先運行它添加,然後運行它應該使用增量並將值打印到屏幕上。
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