123456789101112131415161718192021222324252627 |
- package com.qmth.cet.plug.lock;
- import org.springframework.stereotype.Component;
- import javax.annotation.Resource;
- @Component
- public class LockService {
- @Resource
- private MemoryLock memoryLock;
- /**
- * 加锁
- *
- * @param key 缓存key
- * @param value 缓存value
- * @param timeout 缓存过期时间 单位毫秒
- */
- public boolean lock(String key, String value, int timeout) {
- return memoryLock.lock(key, value, timeout);
- }
- public void unlock(String key, String value) {
- memoryLock.unlock(key, value);
- }
- }
|