Tag:ops res Example message llb return redis redist exce
Redistemplate.execute (New Rediscallback () {
Public Long Doinredis (redisconnection connection) throws DataAccessException {
Long result = 0;
result = Connection.del (Key.getbytes ());
return result;
}
});
Example
Take the verification code from the cache, according to the user name, whether or not to match the incoming
Final String Key = cus.getusername () + "Verificationcode";
Object Strverificationcode = Redistemplate.opsforvalue (). get (Key);
if (Strverificationcode = = null)//verification code not taken to {
Message.setcode (Constantutil.m_data_expire);
Message.setmessage ("The Verification code has expired, please re-obtain");
This.out (response, message); Return
}
if (! ( Strverificationcode.equals (ZipCode))) {
Message.setcode (constantutil.m_exception);
Message.setmessage ("Captcha error");
This.out (response, message);
Return
} else {//validation pass, delete verification code
Redistemplate.execute (New Rediscallback () {
Public Long Doinredis (redisconnection connection) throws DataAccessException {
Long result = 0;
result = Connection.del (Key.getbytes ());
return result;
}
});
}
Spring Delete Redis