-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Caching! Makefile improvements! Update screen!
- Loading branch information
1 parent
974294e
commit b308f61
Showing
10 changed files
with
215 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package config | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
// Set is a quick interface to a key value cache. | ||
// dur is the amount of time to cache the object before deleting | ||
// if 0 then will cache infinitely | ||
func Set(key string, value interface{}, dur time.Duration) error { | ||
|
||
if err := DB.Set("cache", key, value); err != nil { | ||
return err | ||
} | ||
|
||
if dur.Seconds() > 0 { | ||
go func() { | ||
time.Sleep(dur) | ||
Delete(key) | ||
}() | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// Get a value from the key value cache. | ||
// Returns nil if not found. | ||
func Get(key string) interface{} { | ||
var i interface{} | ||
|
||
DB.Get("cache", key, &i) | ||
|
||
return i | ||
} | ||
|
||
// Delete a value from the key value cache. | ||
func Delete(key string) error { | ||
return DB.Delete("cache", key) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,9 @@ func Open() error { | |
createConfig() | ||
} | ||
|
||
// Refresh the cache | ||
DB.Drop("cache") | ||
|
||
return nil | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{{define "content"}} | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<div class="card card-plain"> | ||
<div class="card-header" data-background-color="purple"> | ||
<h4 class="title">Update</h4> | ||
<p class="category">You can update to a specific version by clicking the respective button.</p> | ||
</div> | ||
<div class="card-content table-responsive"> | ||
<table class="table table-hover"> | ||
<thead> | ||
<th>Version</th> | ||
<th>Name</th> | ||
<th>Published At</th> | ||
<th>Description</th> | ||
<th>Actions</th> | ||
</thead> | ||
<tbody> | ||
{{range .Releases}} | ||
<tr> | ||
<td>{{.Version}}</td> | ||
<td>{{.Name}}</td> | ||
<td>{{.PublishedAt}}</td> | ||
<td> | ||
{{if .PreRelease}} | ||
<b>PRERELEASE:</b> | ||
<br> {{end}} {{.Description}} | ||
</td> | ||
<td class="td-actions text-right"> | ||
<a href="{{.InfoURL}}"> | ||
<button type="button" rel="tooltip" class="btn btn-info" data-original-title="" title=""> | ||
<i class="material-icons">info</i> | ||
<div class="ripple-container"></div> | ||
</button> | ||
</a> | ||
<button description="{{.Description}}" version="{{.Version}}" type="button" rel="tooltip" class="btn btn-success update-button" | ||
data-original-title="" title=""> | ||
<i class="material-icons">get_app</i> | ||
<div class="ripple-container"></div> | ||
</button> | ||
</td> | ||
</tr> | ||
{{end}} | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{{end}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters