mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2026-07-15 22:41:14 +00:00
refactor: rework rate limit logic (#1008)
This commit is contained in:
@@ -316,6 +316,21 @@ func TestCacheStoreSizeAndClear(t *testing.T) {
|
||||
assert.False(t, ok)
|
||||
}
|
||||
|
||||
func TestCacheStoreWithMaxSize(t *testing.T) {
|
||||
cs := NewCacheStore[string](0)
|
||||
assert.Equal(t, 0, cs.Size())
|
||||
|
||||
for i := 0; i < 100; i++ {
|
||||
cs.Set(strconv.Itoa(i), strconv.Itoa(i), 0)
|
||||
}
|
||||
|
||||
assert.Equal(t, 100, cs.Size())
|
||||
|
||||
cs.SetMaxSize(10)
|
||||
|
||||
assert.Equal(t, 10, cs.Size())
|
||||
}
|
||||
|
||||
func TestCacheStoreWithLock(t *testing.T) {
|
||||
cs := NewCacheStore[int](0)
|
||||
cs.Set("counter", 1, 0)
|
||||
|
||||
Reference in New Issue
Block a user