Example #1
0
func (a *App) BuildDefaultCache() {
	// Build cache.
	dir := a.registry.Config().UString("caches.fs.dir")
	if dir == "" {
		dir = a.registry.Config().TmpDir() + "/" + "cache"
	}
	fsCache, err := fs.New(dir)
	if err != nil {
		panic("Could not initialize fs cache: " + err.Error())
	}
	a.RegisterCache(fsCache)
}
Example #2
0
package fs_test

import (
	"os"
	"path"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"github.com/app-kit/go-appkit/caches/fs"
	"github.com/app-kit/go-appkit/caches/tests"
)

var _ = Describe("Redis", func() {
	tmpDir := path.Join(os.TempDir(), "appkit_caches_fs_test")
	cache, err := fs.New(tmpDir)
	if err != nil {
		panic(err)
	}

	It("Should create", func() {
		_, err := fs.New(tmpDir)
		Expect(err).ToNot(HaveOccurred())
	})

	tests.TestCache(cache)
})