Added caching capabilities for image requests

This commit is contained in:
2020-06-12 22:40:37 -05:00
parent ffbfce3ebb
commit e5e9905824
2 changed files with 126 additions and 38 deletions

View File

@@ -15,6 +15,10 @@ import (
var (
auth Auth
redditbooru_sources []string
// cache settings
cache_location string = "cache/"
cache_time = 3 * time.Hour // 3 hours
)
func init() {
@@ -26,6 +30,11 @@ func init() {
// build the redditbooru sources slice
build_redditbooru_sources()
// attempt to make our cached
if _, err := os.Stat(cache_location); os.IsNotExist(err) {
os.Mkdir(cache_location, 0777)
}
}
func main() {