@Override public V put(K key, V value) throws CacheException { if (log.isTraceEnabled()) { log.trace("Putting object in cache[{}] for key[{}]", name, key); } try { cacheService.set(name, key.toString(), serializeValue(value)); return null; } catch (Throwable t) { throw new CacheException(t); } }
public void set(String phone, String type, Long time) throws ServiceException { cache.set(SMS_LAST_SEND_TIME, getKey(phone, type), time); if (expired != null) { cache.expire(SMS_LAST_SEND_TIME, getKey(phone, type), expired); } }
public void sendChangePhoneValidCode(String email) throws ServiceException { String msg = "Failed to SendChangePhoneCode. "; checkEmail(email, msg); // 获得验证码 String validCode = RandomTools.generateNumber(4); // 存入缓存 // 缓存时间(单位:秒) int time = smsService.getCacheTime(Constants.EmailTemplate.change_email); cache.set(CacheKeys.VALID_CODE_CHANGE_PHONE.name(), email, validCode, new Second(time)); // 验证码:@1@,@2@分钟内有效。 smsService.send(email, Constants.EmailTemplate.change_email, validCode, time / 60); }
public void sendRegisterValidCode(String phone) throws ServiceException { String msg = "Failed to SendRegisterCode. "; checkPhone(phone, msg); // 获得验证码 String validCode = RandomTools.generateNumber(4); // 存入缓存 // 缓存时间(单位:秒) int time = smsService.getCacheTime(Constants.SmsTemplate.register); cache.set(CacheKeys.VALID_CODE_REGISTER.name(), phone, validCode, new Second(time)); // 验证码:@1@,@2@分钟内有效。 smsService.send(phone, Constants.SmsTemplate.register, validCode, time / 60); }
public void sendLoginValidCode(String email) throws ServiceException { String msg = "Failed to SendLoginCode. "; checkEmail(email, msg); // 获得验证码 String validCode = RandomTools.generateNumber(4); // 存入缓存 // 缓存时间(单位:秒) int time = smsService.getCacheTime(Constants.EmailTemplate.login); cache.set(CacheKeys.VALID_CODE_LOGIN.name(), email, validCode, new Second(time)); // 验证码:@1@,@2@分钟内有效。 smsService.send(email, Constants.EmailTemplate.login, validCode, time / 60); }
public void sendRegisterValidCode(String email) throws ServiceException { String msg = "Failed to SendRegisterCode. "; checkEmail(email, msg); // 获得验证码 String validCode = RandomTools.generateNumber(4); // 存入缓存 // 缓存时间(单位:秒) int time = smsService.getCacheTime(Constants.EmailTemplate.register); cache.set(CacheKeys.VALID_CODE_REGISTER.name(), email, validCode, new Second(time)); // 验证码:@1@,@2@分钟内有效。 smsService.send(email, Constants.EmailTemplate.register, validCode, time / 60); }
public void sendLoginValidCode(String phone) throws ServiceException { String msg = "Failed to SendLoginCode. "; checkPhone(phone, msg); // 获得验证码 String validCode = RandomTools.generateNumber(4); // 存入缓存 // 缓存时间(单位:秒) int time = smsService.getCacheTime(Constants.SmsTemplate.login); cache.set(CacheKeys.VALID_CODE_LOGIN.name(), phone, validCode, new Second(time)); // 验证码:@1@,@2@分钟内有效。 smsService.send(phone, Constants.SmsTemplate.login, validCode, time / 60); }
public void sendChangePhoneValidCode(String phone) throws ServiceException { String msg = "Failed to SendChangePhoneCode. "; checkPhone(phone, msg); // 获得验证码 String validCode = RandomTools.generateNumber(4); // 存入缓存 // 缓存时间(单位:秒) int time = smsService.getCacheTime(Constants.SmsTemplate.change_phone); cache.set(CacheKeys.VALID_CODE_CHANGE_PHONE.name(), phone, validCode, new Second(time)); // 验证码:@1@,@2@分钟内有效。 smsService.send(phone, Constants.SmsTemplate.change_phone, validCode, time / 60); }
public void sendRepasswordValidCode(String email) throws ServiceException { String msg = "Failed to SendRepasswordCode. "; checkEmail(email, msg); // 获得验证码 String validCode = RandomTools.generateNumber(4); // 存入缓存 // 缓存时间(单位:秒) int time = smsService.getCacheTime(Constants.EmailTemplate.repassword); cache.set(CacheKeys.VALID_CODE_REPASSWORD.name(), email, validCode, new Second(time)); // 验证码:@1@,@2@分钟内有效。 smsService.send(email, Constants.EmailTemplate.repassword, validCode, time / 60); }
public void sendRepasswordValidCode(String phone) throws ServiceException { String msg = "Failed to SendRepasswordCode. "; checkPhone(phone, msg); // 获得验证码 String validCode = RandomTools.generateNumber(4); // 存入缓存 // 缓存时间(单位:秒) int time = smsService.getCacheTime(Constants.SmsTemplate.repassword); cache.set(CacheKeys.VALID_CODE_REPASSWORD.name(), phone, validCode, new Second(time)); // 验证码:@1@,@2@分钟内有效。 smsService.send(phone, Constants.SmsTemplate.repassword, validCode, time / 60); }