// TODO: Create getter methods in WoTIdentityManager which actually use this caching function... public synchronized int getScore(final WoTOwnIdentity truster, final WoTIdentity trustee) throws NotInTrustTreeException, Exception { { final Integer cachedValue = mScoreCache.get(new TrustKey(truster, trustee)); if (cachedValue != null) return cachedValue; } return WoTIdentityManager.this.getScore(truster, trustee); // This will update the cache }
// TODO: Create getter methods in WoTIdentityManager which actually use this caching function... public synchronized byte getTrust(final WoTOwnIdentity truster, final WoTIdentity trustee) throws NotTrustedException, Exception { { final Byte cachedValue = mTrustCache.get(new TrustKey(truster, trustee)); if (cachedValue != null) return cachedValue; } return WoTIdentityManager.this.getTrust(truster, trustee); // This will update the cache }
public synchronized void putScore( final WoTOwnIdentity truster, final WoTIdentity trustee, final int value) { mScoreCache.put(new TrustKey(truster, trustee), value); }
public synchronized void putTrust(final WoTTrust trust) { mTrustCache.put(new TrustKey(trust), trust.getValue()); }
public synchronized void putTrust( final WoTIdentity truster, final WoTIdentity trustee, final byte value) { mTrustCache.put(new TrustKey(truster, trustee), value); }