mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-05-12 02:09:43 +08:00
feat: download telegraph images , close #5
This commit is contained in:
@@ -21,10 +21,12 @@ func initCache() {
|
||||
gob.Register(types.File{})
|
||||
gob.Register(tg.InputDocumentFileLocation{})
|
||||
gob.Register(tg.InputPhotoFileLocation{})
|
||||
gob.Register(tg.Message{})
|
||||
gob.Register(tg.PeerUser{})
|
||||
Cache = &CommonCache{cache: freecache.NewCache(10 * 1024 * 1024)}
|
||||
}
|
||||
|
||||
func (c *CommonCache) Get(key string, value *types.File) error {
|
||||
func (c *CommonCache) Get(key string, value any) error {
|
||||
c.mu.RLock()
|
||||
defer c.mu.RUnlock()
|
||||
data, err := Cache.cache.Get([]byte(key))
|
||||
@@ -39,7 +41,7 @@ func (c *CommonCache) Get(key string, value *types.File) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *CommonCache) Set(key string, value *types.File, expireSeconds int) error {
|
||||
func (c *CommonCache) Set(key string, value any, expireSeconds int) error {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
var buf bytes.Buffer
|
||||
|
||||
Reference in New Issue
Block a user