Updated to latest GTK2 bindings API and moved to Gitlab.
This commit is contained in:
50
cache/cache_object.go
vendored
50
cache/cache_object.go
vendored
@@ -10,41 +10,41 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
// stdlib
|
||||
"fmt"
|
||||
"sync"
|
||||
// stdlib
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/urtrator/cachemodels"
|
||||
// local
|
||||
"gitlab.com/pztrn/urtrator/cachemodels"
|
||||
)
|
||||
|
||||
type Cache struct {
|
||||
// Profiles cache.
|
||||
Profiles map[string]*cachemodels.Profile
|
||||
// Profiles cache mutex.
|
||||
ProfilesMutex sync.Mutex
|
||||
// Servers cache.
|
||||
Servers map[string]*cachemodels.Server
|
||||
// Servers cache mutex.
|
||||
ServersMutex sync.Mutex
|
||||
// Profiles cache.
|
||||
Profiles map[string]*cachemodels.Profile
|
||||
// Profiles cache mutex.
|
||||
ProfilesMutex sync.Mutex
|
||||
// Servers cache.
|
||||
Servers map[string]*cachemodels.Server
|
||||
// Servers cache mutex.
|
||||
ServersMutex sync.Mutex
|
||||
}
|
||||
|
||||
func (c *Cache) Initialize() {
|
||||
fmt.Println("Initializing cache...")
|
||||
c.initializeStorages()
|
||||
c.LoadServers(map[string]string{})
|
||||
fmt.Println("Initializing cache...")
|
||||
c.initializeStorages()
|
||||
c.LoadServers(map[string]string{})
|
||||
|
||||
Eventer.AddEventHandler("deleteProfile", c.deleteProfile)
|
||||
Eventer.AddEventHandler("flushProfiles", c.FlushProfiles)
|
||||
Eventer.AddEventHandler("loadProfiles", c.LoadProfiles)
|
||||
Eventer.AddEventHandler("deleteProfile", c.deleteProfile)
|
||||
Eventer.AddEventHandler("flushProfiles", c.FlushProfiles)
|
||||
Eventer.AddEventHandler("loadProfiles", c.LoadProfiles)
|
||||
|
||||
Eventer.AddEventHandler("flushServers", c.FlushServers)
|
||||
Eventer.AddEventHandler("loadServersIntoCache", c.LoadServers)
|
||||
Eventer.AddEventHandler("flushServers", c.FlushServers)
|
||||
Eventer.AddEventHandler("loadServersIntoCache", c.LoadServers)
|
||||
}
|
||||
|
||||
func (c *Cache) initializeStorages() {
|
||||
// Profiles cache.
|
||||
c.Profiles = make(map[string]*cachemodels.Profile)
|
||||
// Servers cache.
|
||||
c.Servers = make(map[string]*cachemodels.Server)
|
||||
// Profiles cache.
|
||||
c.Profiles = make(map[string]*cachemodels.Profile)
|
||||
// Servers cache.
|
||||
c.Servers = make(map[string]*cachemodels.Server)
|
||||
}
|
||||
|
Reference in New Issue
Block a user