diff options
Diffstat (limited to 'system/db')
-rw-r--r-- | system/db/config.go | 11 | ||||
-rw-r--r-- | system/db/content.go | 18 |
2 files changed, 18 insertions, 11 deletions
diff --git a/system/db/config.go b/system/db/config.go index ab1c720..b5a07e4 100644 --- a/system/db/config.go +++ b/system/db/config.go @@ -2,12 +2,9 @@ package db import ( "bytes" - "encoding/base64" "encoding/json" - "fmt" "net/url" "strings" - "time" "github.com/bosssauce/ponzu/system/admin/config" @@ -124,11 +121,3 @@ func ConfigAll() ([]byte, error) { func ConfigCache(key string) string { return configCache.Get(key) } - -// NewEtag generates a new Etag for response caching -func NewEtag() string { - now := fmt.Sprintf("%d", time.Now().Unix()) - etag := base64.StdEncoding.EncodeToString([]byte(now)) - - return etag -} diff --git a/system/db/content.go b/system/db/content.go index 74a77ec..19c31d7 100644 --- a/system/db/content.go +++ b/system/db/content.go @@ -77,6 +77,12 @@ func update(ns, id string, data url.Values) (int, error) { go SortContent(ns) } + // update changes data, so invalidate client caching + err = InvalidateCache() + if err != nil { + return 0, err + } + return cid, nil } @@ -132,6 +138,12 @@ func insert(ns string, data url.Values) (int, error) { go SortContent(ns) } + // insert changes data, so invalidate client caching + err = InvalidateCache() + if err != nil { + return 0, err + } + return effectedID, nil } @@ -149,6 +161,12 @@ func DeleteContent(target string) error { return err } + // delete changes data, so invalidate client caching + err = InvalidateCache() + if err != nil { + return err + } + // exception to typical "run in goroutine" pattern: // we want to have an updated admin view as soon as this is deleted, so // in some cases, the delete and redirect is faster than the sort, |