shan
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
package storeskulock
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
)
|
||||
|
||||
const (
|
||||
cacheKeyPrefix = "jdpromotion"
|
||||
)
|
||||
|
||||
func LockJdStoreSku(jdStoreID string, jdSkuID int64, expire time.Time) {
|
||||
return
|
||||
globals.SugarLogger.Debug(expire, " ", time.Now())
|
||||
duration := expire.Sub(time.Now())
|
||||
if duration > 0 {
|
||||
api.Cacher.Set(genCacheKey(jdStoreID, jdSkuID), 1, duration)
|
||||
}
|
||||
}
|
||||
|
||||
func UnlockJdStoreSku(jdStoreID string, jdSkuID int64) {
|
||||
api.Cacher.Del(genCacheKey(jdStoreID, jdSkuID))
|
||||
}
|
||||
|
||||
func IsJdStoreSkuLocked(jdStoreID string, jdSkuID int64) bool {
|
||||
return false
|
||||
return api.Cacher.Get(genCacheKey(jdStoreID, jdSkuID)) != nil
|
||||
}
|
||||
|
||||
func ClearJdStoreSkuLock() {
|
||||
api.Cacher.FlushKeys(cacheKeyPrefix)
|
||||
}
|
||||
|
||||
func genCacheKey(jdStoreID string, jdSkuID int64) string {
|
||||
return fmt.Sprintf("%s.%s.%d", cacheKeyPrefix, jdStoreID, jdSkuID)
|
||||
}
|
||||
Reference in New Issue
Block a user