code: protected Entity cacheLoadOrStore(Entity entity) {
          Entity cachedEntity = entityCache.findInCache(entity.getClass(),
                                                        entity.getId());
          if (cachedEntity != null) {
              return cachedEntity;
          }
          entityCache.put(entity,
                          true);
          return entity;
      }
docs: Returns the object in the cache. If this object was loaded before, then the original object is returned (the cached version is more recent).
  If this is the first time this object is loaded, then the loadedObject is added to the cache.