mirror of
https://github.com/elyby/chrly.git
synced 2025-05-31 14:11:51 +05:30
Fixes #9. Start GC loop for in-memory textures cache.
This commit is contained in:
@@ -25,9 +25,12 @@ type inMemoryTexturesStorage struct {
|
||||
}
|
||||
|
||||
func CreateInMemoryTexturesStorage() *inMemoryTexturesStorage {
|
||||
return &inMemoryTexturesStorage{
|
||||
storage := &inMemoryTexturesStorage{
|
||||
data: make(map[string]*inMemoryItem),
|
||||
}
|
||||
storage.Start()
|
||||
|
||||
return storage
|
||||
}
|
||||
|
||||
func (s *inMemoryTexturesStorage) Start() {
|
||||
|
@@ -178,8 +178,6 @@ func TestInMemoryTexturesStorage_GarbageCollection(t *testing.T) {
|
||||
storage.StoreTextures("dead24f9a4fa4877b7b04c8c6c72bb46", textures1)
|
||||
storage.StoreTextures("b5d58475007d4f9e9ddd1403e2497579", textures2)
|
||||
|
||||
storage.Start()
|
||||
|
||||
time.Sleep(inMemoryStorageGCPeriod + time.Millisecond) // Let it start first iteration
|
||||
|
||||
_, textures1Err := storage.GetTextures("dead24f9a4fa4877b7b04c8c6c72bb46")
|
||||
|
Reference in New Issue
Block a user