Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
Cache = cache.New(5*time.Minute, 5*time.Minute)
)
Functions ¶
func AddCacheItem ¶
func AddCacheItem(id string, data *model.LookupResponse) error
AddCacheItem sets an item in the cache for the given key
func GetCacheById ¶
func GetCacheById(id string) (*model.LookupResponse, error)
GetCacheById retrieves an item from the cache for the given key
func GetEnvFilePath ¶
func GetEnvFilePath() string
GetEnvFilePath retrieves the absolute file path of the .env file in the directory where the calling function is located. If the caller information cannot be obtained, a message will be printed to the console. The function combines the directory path and the name of the .env file using filepath.Join. Returns the absolute file path of the .env file.
func GetGeoInfo ¶
GetGeoInfo accepts an IP Address to perform a lookup of the geolocation information of the IP Address form KeyCDNs' Geo service. This service is rate limited to a maximum of 3 calls per second.
func InitDatabase ¶
func InitDatabase()
func Record ¶
func Record(lookupRequest *model.LookupRequest)
Types ¶
type CacheItem ¶
type CacheItem []struct { ID string `json:"id"` Data *model.LookupResponse `json:"data"` }
CacheItem struct holds the string key and the cached pointer of the item being cached