mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-18 06:44:22 +01:00
fix slowness of previous refactors that injected nostr-sdk into this codebase + refactors.
- adjusting many small things related to nostr-sdk usage - fetching profiles in a smarter way - decoupling the logic for rendering profile pages from the `grabData`/`getEvent` flow of other event pages. - incorporating nostr-sdk more holistically, including more hints stuff - improving nostr-sdk itself after some bugs and weird behaviors observed here - set up opentelemetry (should probably remove this later)
This commit is contained in:
13
cache.go
13
cache.go
@@ -8,20 +8,15 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/dgraph-io/badger/v4"
|
||||
"github.com/fiatjaf/eventstore"
|
||||
eventstore_badger "github.com/fiatjaf/eventstore/badger"
|
||||
)
|
||||
|
||||
var (
|
||||
cache = Cache{}
|
||||
db eventstore.Store = &eventstore_badger.BadgerBackend{}
|
||||
)
|
||||
var cache = Cache{}
|
||||
|
||||
type Cache struct {
|
||||
*badger.DB
|
||||
}
|
||||
|
||||
func (c *Cache) initialize() func() {
|
||||
func (c *Cache) initializeCache() func() {
|
||||
db, err := badger.Open(badger.DefaultOptions(s.DiskCachePath))
|
||||
if err != nil {
|
||||
log.Fatal().Err(err).Str("path", s.DiskCachePath).Msg("failed to open badger")
|
||||
@@ -40,7 +35,9 @@ func (c *Cache) initialize() func() {
|
||||
}
|
||||
}()
|
||||
|
||||
return func() { db.Close() }
|
||||
return func() {
|
||||
db.Close()
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Cache) Delete(key string) error {
|
||||
|
||||
Reference in New Issue
Block a user