Post-Migrator/app-cache.go

20 lines
490 B
Go

package main
import "federated.computer/wp-sync-slowtwitch/services/wordpress"
type AppCache struct {
UsersCache map[string]wordpress.UserData
}
func (appCache *AppCache) GetUser(username string) (wordpress.UserData, bool) {
user, ok := appCache.UsersCache[username]
return user, ok
}
func (appCache *AppCache) SetUser(user wordpress.UserData) {
if appCache.UsersCache == nil {
appCache.UsersCache = make(map[string]wordpress.UserData)
}
appCache.UsersCache[user.Name] = user
}