本文整理汇总了Java中net.sf.ehcache.Element.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java Element.getValue方法的具体用法?Java Element.getValue怎么用?Java Element.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.ehcache.Element
的用法示例。
在下文中一共展示了Element.getValue方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: push
import net.sf.ehcache.Element; //导入方法依赖的package包/类
/** 답변을 추천하면 캐시에 저장하고 24시간 제한을 둠.
* @param rePost
* @param weaver
* @param ip
* @return
*/
public boolean push(RePost rePost, Weaver weaver,String ip) {
if(rePost == null || (weaver != null && weaver.equals(rePost.getWriter())))
return false;
rePost.push();
Cache cache = cacheManager.getCache("push");
Element element = cache.get("re"+rePost.getRePostID()+"@@"+ip);
if (element == null || (element != null && element.getValue() == null)) {
rePostDao.update(rePost);
Element newElement = new Element("re"+rePost.getRePostID()+"@@"+ip, ip);
cache.put(newElement);
weaverDao.update(rePost.getWriter());
return true;
}
return false;
}
示例2: push
import net.sf.ehcache.Element; //导入方法依赖的package包/类
/** 글 추천하면 캐시에 저장하고 24시간 제한을 둠.
* @param post
* @param weaver
* @return
*/
public boolean push(Post post, Weaver weaver,String ip) {
if (weaver != null && weaver.equals(post.getWriter()))
return false;
Cache cache = cacheManager.getCache("push"); // 중복 추천 방지!
Element element = cache.get(post.getPostID()+"@@"+ip);
if (element == null || (element != null && element.getValue() == null)) {
post.push();
postDao.update(post);
Element newElement = new Element(post.getPostID()+"@@"+ip, ip);
cache.put(newElement);
return true;
}
return false;
}
示例3: push
import net.sf.ehcache.Element; //导入方法依赖的package包/类
/** 저장소를 추천하면 캐시에 저장하고 24시간 제한을 둠.
* @param repository
* @param weaver
* @param ip
* @return
*/
public boolean push(Repository repository, Weaver weaver,String ip) {
if(repository == null || repository.getAuthLevel() > 0 ||
(weaver == null && repository.isJoinWeaver(weaver)))
return false;
Cache cache = cacheManager.getCache("push");
Element element = cache.get(repository.getName()+"@@"+ip);
if (element == null || (element != null && element.getValue() == null)) {
repository.push();
repositoryDao.update(repository);
Element newElement = new Element(repository.getName()+"@@"+ip, ip);
cache.put(newElement);
return true;
}
return false;
}
示例4: get
import net.sf.ehcache.Element; //导入方法依赖的package包/类
/**
* Gets a value of an element which matches the given key.
* @param key the key of the element to return.
* @return The value placed into the cache with an earlier put, or null if not found or expired
* @throws CacheException
*/
public Object get(Object key) throws CacheException {
try {
if ( log.isDebugEnabled() ) {
log.debug("key: " + key);
}
if (key == null) {
return null;
}
else {
Element element = cache.get( (Serializable) key );
if (element == null) {
if ( log.isDebugEnabled() ) {
log.debug("Element for " + key + " is null");
}
return null;
}
else {
return element.getValue();
}
}
}
catch (net.sf.ehcache.CacheException e) {
throw new CacheException(e);
}
}
示例5: getCachedBuildRightSet
import net.sf.ehcache.Element; //导入方法依赖的package包/类
private BuildRights getCachedBuildRightSet(final int activeBuildID, final int userID) {
BuildRights buildRights = null;
try {
final Cache cache = getBuildRightSetCache(activeBuildID);
if (cache == null) {
return null;
}
final Element element = cache.get(new Integer(userID));
if (element != null) {
buildRights = (BuildRights) element.getValue();
}
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug("e: " + e);
}
}
// if (log.isDebugEnabled()) log.debug("cached rightSet for build ID " + activeBuildID + ", user ID " + userID + " : " + rightSet);
return buildRights;
}
示例6: getCachedResultGroupRightSet
import net.sf.ehcache.Element; //导入方法依赖的package包/类
/**
* Returns cached {@link ResultGroupRights} for the given result group and user ID
*
* @return cached {@link ResultGroupRights} for the given result group and user ID.
*/
private ResultGroupRights getCachedResultGroupRightSet(final int resultGroupID, final int userID) {
ResultGroupRights resultGroupRights = null;
try {
final Cache cache = getResultGroupRightSetCache(resultGroupID);
if (cache == null) {
return null;
}
final Element element = cache.get(new Integer(userID));
if (element != null) {
resultGroupRights = (ResultGroupRights) element.getValue();
}
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug("e: " + e);
}
}
// if (log.isDebugEnabled()) log.debug("cached rightSet for build ID " + resultGroupID + ", user ID " + userID + " : " + rightSet);
return resultGroupRights;
}
示例7: getSystemPropertyValue
import net.sf.ehcache.Element; //导入方法依赖的package包/类
/**
* @return system property by name or default value if not
* found.
*/
public String getSystemPropertyValue(final String propertyName, final String defaultValue) {
try {
final Cache cache = getSystemPropertyCache();
final Element element = cache.get(propertyName);
if (element == null) {
final String value = getSystemPropertyValueFromDB(propertyName, defaultValue);
cache.put(new Element(propertyName, value));
return value;
} else {
return (String) element.getValue();
}
} catch (final CacheException ignored) {
return getSystemPropertyValueFromDB(propertyName, defaultValue);
}
}
示例8: changePassword
import net.sf.ehcache.Element; //导入方法依赖的package包/类
/** 인증된 키를 통해 재발급된 비밀번호로 변경하는 메서드
* @param email
* @param key
* @return 성공여부
*/
public boolean changePassword(String email,String key){
Cache rePasswordCache = cacheManager.getCache("repassword");
Element element = rePasswordCache.get(email);
if(element == null)
return false;
RePassword rePassword = (RePassword)element.getValue();
if(rePassword.getKey().equals(key)){
Weaver weaver = weaverDao.get(email);
weaver.setPassword(passwordEncoder.encodePassword(rePassword.getPassword(),null));
weaverDao.update(weaver);
}
return true;
}
示例9: getObjectID
import net.sf.ehcache.Element; //导入方法依赖的package包/类
public String getObjectID(String dataName,Weaver weaver){
Cache tmpNameCache = cacheManager.getCache("tmpName");
dataName = dataName.replace(" ", "_");
dataName = dataName.replace("?", "_");
dataName = dataName.replace("#", "_");
dataName = dataName.trim();
Element element = tmpNameCache.get(weaver.getId()+"/"+dataName);
if(element == null)
return "";
return (String)element.getValue();
}
示例10: get
import net.sf.ehcache.Element; //导入方法依赖的package包/类
@Override
public String get(final Object key) {
final Element element = this.cache.get(key);
return element == null ? null : (String) element.getValue();
}
示例11: isAllowedToSeeErrors
import net.sf.ehcache.Element; //导入方法依赖的package包/类
/**
* Returns true if a user is allowed to see errors.
*
* @param user
* @return
*/
public boolean isAllowedToSeeErrors(final User user) {
try {
// Check if admin.
if (user.isAdmin()) {
return true;
}
// Get cache
final Cache cache = getGeneralAccessRightsCache();
if (cache == null) {
return false;
}
// Return cached if present
final Integer userID = new Integer(user.getUserID());
final Element element = cache.get(userID);
if (element != null) {
final Boolean allowed = (Boolean) element.getValue();
return allowed.booleanValue();
}
// Calcualte access rights
final List groups = (List) ConfigurationManager.runInHibernate(new TransactionCallback() {
public Object runInTransaction() throws Exception {
return session.createQuery("select gr from User u, Group as gr, UserGroup as ug, GroupBuildAccess as gba" +
" where u.userID = ? " +
" and gba.groupID = ug.groupID " +
" and ug.userID = u.userID " +
" and gr.ID = ug.groupID ")
.setCacheable(true)
.setInteger(0, user.getUserID())
.list();
}
});
boolean allowedToSeeErrors = false;
for (final Iterator iterator = groups.iterator(); iterator.hasNext() && !allowedToSeeErrors;) {
final Group group = (Group) iterator.next();
allowedToSeeErrors |= group.isAllowedToCreateBuild();
allowedToSeeErrors |= group.isAllowedToDeleteBuild();
allowedToSeeErrors |= group.isAllowedToStartBuild();
allowedToSeeErrors |= group.isAllowedToStopBuild();
allowedToSeeErrors |= group.isAllowedToUpdateBuild();
}
// Cache
cache.put(new Element(userID, Boolean.valueOf(allowedToSeeErrors)));
// Return result
return allowedToSeeErrors;
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug("e: " + e);
}
return false;
}
}