remove cache of existing user hashes

This commit is contained in:
Darien Raymond committed 2016-01-25 10:54:03 +00:00
1 parent 1a10f7c4da
commit 4624de091b
3 files changed
+19 -59

No files matched your search

-24
View File
@@ -1,24 +0,0 @@
package collect
type SizedQueue struct {
elements []interface{}
nextPos int
}
func NewSizedQueue(size int) *SizedQueue {
return &SizedQueue{
elements: make([]interface{}, size),
nextPos: 0,
}
}
// Put puts a new element into the queue and pop out the first element if queue is full.
func (this *SizedQueue) Put(element interface{}) interface{} {
res := this.elements[this.nextPos]
this.elements[this.nextPos] = element
this.nextPos++
if this.nextPos == len(this.elements) {
this.nextPos = 0
}
return res
}
-18
View File
@@ -1,18 +0,0 @@
package collect_test
import (
"testing"
"github.com/v2ray/v2ray-core/common/collect"
v2testing "github.com/v2ray/v2ray-core/testing"
"github.com/v2ray/v2ray-core/testing/assert"
)
func TestSizedQueue(t *testing.T) {
v2testing.Current(t)
queue := collect.NewSizedQueue(2)
assert.Pointer(queue.Put(1)).IsNil()
assert.Pointer(queue.Put(2)).IsNil()
assert.Int(queue.Put(3).(int)).Equals(1)
}