Cleanup and documentation.

This commit is contained in:
mikestefanello 2024-06-22 09:43:24 -04:00
parent 2004d6b139
commit 60a4a107ca
6 changed files with 93 additions and 151 deletions

View file

@ -50,11 +50,12 @@ func (h *Cache) Page(ctx echo.Context) error {
p.Form = form.Get[cacheForm](ctx)
// Fetch the value from the cache
value, err := h.cache.Get().
value, err := h.cache.
Get().
Key("page_cache_example").
Fetch(ctx.Request().Context())
// Store the value in the page so it can be rendered, if found
// Store the value in the page, so it can be rendered, if found
switch {
case err == nil:
p.Data = value.(string)
@ -74,10 +75,11 @@ func (h *Cache) Submit(ctx echo.Context) error {
}
// Set the cache
err := h.cache.Set().
err := h.cache.
Set().
Key("page_cache_example").
Data(input.Value).
Expiration(10 * time.Minute).
Expiration(30 * time.Minute).
Save(ctx.Request().Context())
if err != nil {

View file

@ -70,11 +70,9 @@ func NewContainer() *Container {
return c
}
// Shutdown shuts the Container down and disconnects all connections
// Shutdown shuts the Container down and disconnects all connections.
// If the task runner was started, cancel the context to shut it down prior to calling this.
func (c *Container) Shutdown() error {
//if err := c.Tasks.Close(); err != nil {
// return err
//}
if err := c.ORM.Close(); err != nil {
return err
}