mirror of
https://github.com/nadoo/glider.git
synced 2025-02-24 01:45:39 +08:00
dns: change non-expired ttl to 50years to avoid int overflow on 32bit os
This commit is contained in:
parent
c049b75b64
commit
6cdfbc3552
@ -5,8 +5,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HundredYears is one hundred years duration in seconds, used for none-expired items
|
// LongTTL is 50 years duration in seconds, used for none-expired items
|
||||||
const HundredYears = 100 * 365 * 24 * 3600
|
const LongTTL = 50 * 365 * 24 * 3600
|
||||||
|
|
||||||
type item struct {
|
type item struct {
|
||||||
value []byte
|
value []byte
|
||||||
|
@ -218,7 +218,7 @@ func (c *Client) AddRecord(record string) error {
|
|||||||
binary.Write(&buf, binary.BigEndian, uint16(len(b)))
|
binary.Write(&buf, binary.BigEndian, uint16(len(b)))
|
||||||
buf.Write(b)
|
buf.Write(b)
|
||||||
|
|
||||||
c.cache.Put(getKey(m.Question), buf.Bytes(), HundredYears)
|
c.cache.Put(getKey(m.Question), buf.Bytes(), LongTTL)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user