You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: resultcache.go
    path of file: ./repos/faygo/ext/db/directsqlx
    
    the code of the file until where you have to start completion: /**
* func   : 查询sql结果缓存处理单元
* author : 畅雨
* date   : 2016.11.25
* desc   : 缓存查询的结果
* history :
           - 2106.11.30 -优化缓存的存储
*/
package directsqlx

import (
	"sync"
	"time"

	"github.com/andeya/faygo"
)

// 缓存结果对象
type memo struct {
	Timeout time.Time
	Result  []byte // interface{}
	Suffix  string // 附加的
    
func SetCache(key string, suffix string, value []byte, timeout int) {
	if value != nil {
		mp.mutex.RLock()
		memoized := mp.pool[key]
		mp.mutex.RUnlock()
		// 缓存key存在值但后缀不同则退出
		if (memoized != nil) && (memoized.Suffix != suffix) {
			return
		}
		// faygo.Debug("Set Cache:[" + key + " - " + suffix + "]")
		// 缓存不存在或虽然存在但suffix后缀相同则修改之
		var duration time.Duration
		// -1为一直有效，-2为一月，-3为一周 -4为一天，单位为分钟
		switch timeout {
		case -1:
			duration = 365 * time.Duration(24) * time.Hour // 一年
		case -2:
			duration = 30 * time.Duration(24) * time.Hour // 一月
		case -3:
			duration = 7 * time.Duration(24) * time.Hour // 一周
		case -4:
			duration = time.Duration(24) * time.Hour // 一天
		default:
			duration = time.Duration(timeout) * time.Minute // 分钟
		}
		mp.mutex.Lock()
		mp.pool[key] = &memo{
			Suffix:  suffix,
			Timeout: time.Now().Add(duration),
			Result:  value,
		}
		mp.mutex.Unlock()
		// faygo.Debug("Set Cache Result:["+key+" - "+suffix+"]", mp.pool[key])
	}
}