List of usage examples for org.springframework.data.redis.core BoundHashOperations get
@Nullable HV get(Object member);
From source file:com.chessix.vas.service.RedisStorage.java
@Override public Integer get(final String clasId, final String accountId) { final BoundHashOperations<String, Object, Object> ops = redisTemplate.boundHashOps(clasId); final String value = (String) ops.get(accountId); if (value != null) { return Integer.parseInt(value); } else {/*from w w w. ja va2 s . c om*/ return null; } }
From source file:net.nikey.redis.UserRepository.java
/** * /* w w w . j a va2 s . c o m*/ * @param uid * @return */ private String findName(String uid) { if (!StringUtils.hasText(uid)) { return ""; } BoundHashOperations<String, String, String> userOps = template.boundHashOps(KeyUtils.uid(uid)); return userOps.get("name"); }
From source file:net.nikey.redis.UserRepository.java
/** * /*w w w. ja v a 2s .co m*/ * @param user * @param pass * @return */ public boolean auth(String user, String pass) { // find uid String uid = findUid(user); if (StringUtils.hasText(uid)) { BoundHashOperations<String, String, String> userOps = template.boundHashOps(KeyUtils.uid(uid)); return userOps.get("pass").equals(pass); } return false; }
From source file:org.shareok.data.redis.RedisConfigImpl.java
@Override public String getFileDownloadPathByNameKey(String nameKey) { String path = null;/*from w w w . ja v a 2 s . co m*/ try { BoundHashOperations<String, String, String> fileDownloadPathsOps = redisTemplate .boundHashOps("file_download_paths"); if (fileDownloadPathsOps.hasKey(nameKey)) { return (String) fileDownloadPathsOps.get(nameKey); } else { throw new FileDownloadPathNotExistException( "The key " + nameKey + " for file downloading does not exist!"); } } catch (Exception ex) { logger.error("Cannot find the download path ", ex); } return path; }
From source file:org.shareok.data.redis.RedisConfigImpl.java
@Override public boolean getRegistrationConfig() { String allowRegistration;/*from w w w . ja v a2 s.co m*/ try { BoundHashOperations<String, String, String> configOps = redisTemplate .boundHashOps(RedisUtil.getConfigQueryKey()); if (configOps.hasKey("registrationConfig")) { allowRegistration = (String) configOps.get("registrationConfig"); } else { allowRegistration = "false"; configOps.put("registrationConfig", "false"); } return Boolean.valueOf(allowRegistration); } catch (Exception ex) { logger.error("Cannot get allow registration info ", ex); return false; } }
From source file:net.eggcanfly.spring.shiro.support.RedisSessionDao.java
protected Session deserializeSession(Serializable sessionId) { BoundHashOperations<String, String, Object> hashOperations = redisTemplate .boundHashOps(SESSION_KEY + sessionId); SimpleSession session = new SimpleSession(); try {/*w ww . ja va 2 s .co m*/ session.setHost((String) hashOperations.get("host")); session.setId(sessionId); session.setLastAccessTime( hashOperations.get("lastAccessTime") == null ? new Date(System.currentTimeMillis()) : (Date) hashOperations.get("lastAccessTime")); session.setStartTimestamp((Date) hashOperations.get("startTimestamp")); session.setStopTimestamp((Date) hashOperations.get("stopTimestamp")); session.setTimeout((long) hashOperations.get("timeout")); Set<String> hashKeys = hashOperations.keys(); for (Iterator<String> iterator = hashKeys.iterator(); iterator.hasNext();) { String hashKey = iterator.next(); session.setAttribute(hashKey, hashOperations.get(hashKey)); } } catch (Exception e) { logger.error(e.getMessage(), e); } logger.debug("read session " + sessionId + ", session is " + session); return session.isValid() ? session : null; }
From source file:org.shareok.data.redis.job.DspaceApiJobDaoImpl.java
@Override public DspaceApiJob findJobByJobId(long jobId) { try {/*from w w w. j ava 2 s. com*/ BoundHashOperations<String, String, String> jobOps = redisTemplate .boundHashOps(RedisUtil.getJobQueryKey(jobId)); if (null != jobOps) { DspaceApiJob job = RedisUtil.getDspaceApiJobInstance(); job.setJobId(jobId); String startTime = (String) jobOps.get("startTime"); job.setStartTime((null == startTime || "".equals(startTime)) ? null : ShareokdataManager.getSimpleDateFormat().parse(startTime)); String endTime = (String) jobOps.get("endTime"); job.setEndTime((null == endTime || "".equals(endTime)) ? null : ShareokdataManager.getSimpleDateFormat().parse(endTime)); job.setUserId(Long.valueOf(jobOps.get("userId"))); job.setServerId(Integer.valueOf(jobOps.get("serverId"))); job.setStatus(Integer.valueOf(jobOps.get("status"))); job.setType(Integer.valueOf(jobOps.get("type"))); // job.setRepoType(Integer.valueOf(jobOps.get("repoType"))); job.setFilePath(jobOps.get("filePath")); job.setCommunityId((String) jobOps.get("communityId")); job.setSubCommunityId((String) jobOps.get("subCommunityId")); job.setCollectionId((String) jobOps.get("collectionId")); job.setItemId((String) jobOps.get("itemId")); job.setBitstreamId((String) jobOps.get("bitstreamId")); job.setPolicyId((String) jobOps.get("policyId")); return job; } else { return null; } } catch (ParseException | NumberFormatException ex) { logger.error("Cannot find the job information by job ID " + jobId, ex); } return null; }
From source file:org.shareok.data.redis.UserDaoImpl.java
@Override public RedisUser findUserByUserEmail(String email) { BoundHashOperations<String, String, String> userOps = redisTemplate .boundHashOps(ShareokdataManager.getRedisUserNameIdMatchingTable()); if (null != userOps) { String id = userOps.get(email); if (null != id && !id.equals("")) { long userId = Long.valueOf(userOps.get(email)); return findUserByUserId(userId); } else {/*from w w w . j a v a2 s. co m*/ return null; } } else { return null; } }
From source file:com.afousan.service.RetwisRepository.java
private String findName(String uid) { if (!StringUtils.hasText(uid)) { return ""; }/* ww w.ja v a2 s. c o m*/ BoundHashOperations<String, String, String> userOps = template.boundHashOps(KeyUtils.uid(uid)); return userOps.get("name"); }
From source file:com.afousan.service.RetwisRepository.java
public boolean auth(String user, String pass) { // find uid//w ww .j av a 2 s .c om String uid = findUid(user); if (StringUtils.hasText(uid)) { BoundHashOperations<String, String, String> userOps = template.boundHashOps(KeyUtils.uid(uid)); return userOps.get("pass").equals(pass); } return false; }