gosora/experimental/plugin_hyperdrive.go
Azareal 225a2cc8a1 0.1.0 tag, checkpoint release.
Upped the user cache capacity and topic cache capacity.
More resource management work. WIP.
Added Hyperdrive to the experimental folder. It doesn't really work right now, but I'd like to track it's progress.
Eliminated a line in global.js
2018-09-19 16:09:03 +10:00

35 lines
730 B
Go

// Highly experimental plugin for caching rendered pages for guests
package main
import (
"sync/atomic"
"./common"
)
var hyperPageCache *HyperPageCache
func init() {
common.Plugins.Add(&common.Plugin{UName: "hyperdrive", Name: "Hyperdrive", Author: "Azareal", Init: initHyperdrive, Deactivate: deactivateHyperdrive})
}
func initHyperdrive() error {
hyperPageCache = newHyperPageCache()
common.Plugins["hyperdrive"].AddHook("somewhere", deactivateHyperdrive)
return nil
}
func deactivateHyperdrive() {
hyperPageCache = nil
}
type HyperPageCache struct {
topicList atomic.Value
}
func newHyperPageCache() *HyperPageCache {
pageCache := new(HyperPageCache)
pageCache.topicList.Store([]byte(""))
return pageCache
}