// 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 }