Documentation
¶
Overview ¶
Package fileCache will provide simple file content caching tools for in-Memory access to files. It uses golang/groupcache to cache your data into memory on multiple HTTP Pool servers.
Index ¶
- Variables
- func DeleteAllBootStrapFileCache() (err error)
- func DeleteAllManifestFileCache() (err error)
- func DeleteBootStrapFileCache(key string) (err error)
- func DeleteManifestFileCache(key string) (err error)
- func DoesHashExistInCache(key string, value string) (exists bool)
- func DoesHashExistInManifestCache(key string, value string) (exists bool)
- func GetFile(path string) ([]byte, error)
- func GetHTMLFile(path string) (string, error)
- func GetString(key string) (string, error)
- func Init(groupCache string)
- func Initialize()
- func InitializeGroupCache(domain string)
- func LoadCachedBootStrapFromKeyIntoMemory(key string) (err error)
- func LoadCachedManifestFromKeyIntoMemory(key string) (err error)
- func LoadJobsFile() (err error)
- func SetGoCoreStoragePath(directory string)
- func SetGroupCache(servers []string)
- func SetString(key string, value string) error
- func UpdateBootStrapMemoryCache(key string, value string)
- func UpdateManifestMemoryCache(key string, value string, byteSize int)
- func WriteBootStrapCacheFile(key string) (err error)
- func WriteJobCacheFile() (err error)
- func WriteManifestCacheFile(key string) (err error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ByteManifest byteManifest
ByteManifest is the in memory model for byte manifest caches
var CACHE_BOOTSTRAP_STORAGE_PATH string
CACHE_BOOTSTRAP_STORAGE_PATH is the directory where bootstrap caches are stored
var CACHE_JOBS string
CACHE_JOBS is the directory where jobs are stored
var CACHE_MANIFEST_STORAGE_PATH string
CACHE_MANIFEST_STORAGE_PATH is the directory where bootstrap caches are stored
var CACHE_STORAGE_PATH string
CACHE_STORAGE_PATH is the base GoCore path where all caches are stored
var Jobs job
Jobs is the in memory model for jobs
var Model model
Model is the in memory model for bootstrap caches
Functions ¶
func DeleteAllBootStrapFileCache ¶
func DeleteAllBootStrapFileCache() (err error)
DeleteAllBootstrapFileCache is exported internally to share between GoCore packages and should not be called directly by you.
func DeleteAllManifestFileCache ¶
func DeleteAllManifestFileCache() (err error)
DeleteAllManifestFileCache is exported internally to share between GoCore packages and should not be called directly by you.
func DeleteBootStrapFileCache ¶
DeleteBootstrapCache is exported internally to share between GoCore packages and should not be called directly by you.
func DeleteManifestFileCache ¶
DeleteManifestFileCache is exported internally to share between GoCore packages and should not be called directly by you.
func DoesHashExistInCache ¶
DoesHashExistInCache is exported internally to share between GoCore packages and should not be called directly by you.
func DoesHashExistInManifestCache ¶
DoesHashExistInManifestCache is exported internally to share between GoCore packages and should not be called directly by you.
func GetHTMLFile ¶
GetHTMLFile returns the html by path (key) from group cache
func Init ¶
func Init(groupCache string)
Init will initilize a groupCache if you pass a non empty string and create necessary folders for internal file caching of GoCore
func Initialize ¶
func Initialize()
Initialize in main before any calls to this package are performed. serverSettings package must be initialized before fileCache. Developers can call SetGoCoreStoragePath() with a path of their choice for storage of where bootstrap caches and jobs files (for one time cron jobs are stored
func InitializeGroupCache ¶
func InitializeGroupCache(domain string)
InitializeGroupCache creates the Peers for group cache and creates caches for multiple types.
func LoadCachedBootStrapFromKeyIntoMemory ¶
LoadCachedBootStrapFileFromKeyIntoMemory is exported internally to share between GoCore packages and should not be called directly by you.
func LoadCachedManifestFromKeyIntoMemory ¶
LoadCachedManifestFileFromKeyIntoMemory is exported internally to share between GoCore packages and should not be called directly by you.
func LoadJobsFile ¶
func LoadJobsFile() (err error)
LoadJobsFile is exported internally to share between GoCore packages and should not be called directly by you.
func SetGoCoreStoragePath ¶
func SetGoCoreStoragePath(directory string)
SetGoCoreStoragePath set a directory with a trailing slash of where you want goCore to set and make directories for caching files needed to keep track of your application cron and bootstrap caches.
func SetGroupCache ¶
func SetGroupCache(servers []string)
SetGroupCache will update the group cache http pool. Use for dynamic systems that update at runtime.
func SetString ¶
SetString sets a Key value pair in group cache
Example ¶
package main import ( "log" "github.com/DanielRenne/GoCore/core/fileCache" ) func main() { fileCache.Init("127.0.0.1") fileCache.SetString("/somePath", "test") val, err := fileCache.GetString("/somePath") if err != nil { log.Println("Could not GetString: " + err.Error()) return } log.Println(val) if val != "test" { log.Println("Error at fileCache_test.TestStringGroupCache\nFailed to return proper matching data " + err.Error()) return } log.Println("Success!") }
Output: 2022/10/04 15:05:24 Initialized Group Cache Succesfully. 2022/10/04 15:05:24 test 2022/10/04 15:05:24 Success!
func UpdateBootStrapMemoryCache ¶
UpdateBootstrapMemoryCache is exported internally to share between GoCore packages and should not be called directly by you.
func UpdateManifestMemoryCache ¶
UpdateManifestMemoryCache is exported internally to share between GoCore packages and should not be called directly by you.
func WriteBootStrapCacheFile ¶
WriteBootstrapCacheFile is exported internally to share between GoCore packages and should not be called directly by you.
func WriteJobCacheFile ¶
func WriteJobCacheFile() (err error)
WriteJobCacheFile is exported internally to share between GoCore packages and should not be called directly by you.
func WriteManifestCacheFile ¶
WriteManifestCacheFile is exported internally to share between GoCore packages and should not be called directly by you.
Types ¶
This section is empty.