bf851bd9fc
Added support for dyntmpl to the template system. The Account Dashboard now sort of uses dyntmpl, more work needed here. Renamed the pre_render_view_topic hook to pre_render_topic. Added the GetCurrentLangPack() function. Added the alerts_no_new_alerts phrase. Added the account_level_list phrase. Refactored the route rename logic in the patcher to cut down on the amount of boilerplate. Added more route renames to the patcher. You will need to run the patcher / updater in this commit.
35 lines
754 B
Go
35 lines
754 B
Go
// Highly experimental plugin for caching rendered pages for guests
|
|
package main
|
|
|
|
import (
|
|
"sync/atomic"
|
|
|
|
"github.com/Azareal/Gosora/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
|
|
}
|