func (c *Cache) Subscribe() {
	err := db.DB.Update(func(tx *bolt.Tx) error {
		c.subscribe(tx)
		return nil
	})
	if err != nil {
		log.Println(err)
	}
}
Subscribe add the thread to thread db.
package thread
import (
	"log"
	"strings"
	"time"
	"github.com/boltdb/bolt"
	"github.com/shingetsu-gou/shingetsu-gou/cfg"
	"github.com/shingetsu-gou/shingetsu-gou/db"
	"github.com/shingetsu-gou/shingetsu-gou/recentlist"
	"github.com/shingetsu-gou/shingetsu-gou/record"
	"github.com/shingetsu-gou/shingetsu-gou/util"
)
type Cache struct {
	Datfile string
}
func NewCache(datfile string) *Cache {
	c := &Cache{
		Datfile: datfile,
	}
	return c
}
func (c *Cache) Stamp() int64 {
	var r []*record.DB
	err := db.DB.View(func(tx *bolt.Tx) error {
		var err error
		r, err = record.GetFromDBs(tx, c.Datfile)
		return err
	})
	if err != nil {
		log.Print(err)
		return 0
	}
	if len(r) == 0 {
		return 0
	}
	var stamp int64
	for i := len(r) - 1; i >= 0; i-- {
		if !r[i].Deleted {
			stamp = r[i].Stamp
			break
		}
	}
	return stamp
}
func (c *Cache) Len(kind int) int {
	m, err := record.FromRecordDB(c.Datfile, kind)
	if err != nil {
		log.Print(err)
		return 0
	}
	return len(m)
}
func (c *Cache) Velocity() int {
	var r []*record.DB
	err := db.DB.View(func(tx *bolt.Tx) error {
		var err error
		r, err = record.GetFromDBs(tx, c.Datfile)
		return err
	})
	if err != nil {
		log.Print(err)
		return 0
	}
	cnt := 0
	t := int64(time.Now().Add(-7 * 24 * time.Hour).Second())
	for _, rr := range r {
		if rr.Stamp > t {
			cnt++
		}
	}
	return cnt
}
func (c *Cache) Size() int64 {
	if c.Len(record.All) == 0 {
		return 0
	}
	var r []*record.DB
	err := db.DB.View(func(tx *bolt.Tx) error {
		var err error
		r, err = record.GetFromDBs(tx, c.Datfile)
		return err
	})
	if err != nil {
		log.Print(err)
		return 0
	}
	var cnt int64
	for _, rr := range r {
		cnt += int64(len(rr.Body))
	}
	return cnt
}
func (c *Cache) LoadRecords(kind int) record.Map {
	m, err := record.FromRecordDB(c.Datfile, kind)
	if err != nil {
		log.Print(err)
		return nil
	}
	return m
}
func (c *Cache) subscribe(tx *bolt.Tx) {
	err := db.Put(tx, "thread", []byte(c.Datfile), []byte(""))
	if err != nil {
		log.Print(err)
	}
}