/** * ADVANCED: * Return the remaining life of this object. This method is associated with use of * cache invalidation and returns the difference between the next expiry * time of the object and its read time. The method will return 0 for invalidated objects. */ public long getRemainingValidTime(Object object) { Object primaryKey = getSession().getId(object); ClassDescriptor descriptor = getSession().getDescriptor(object); CacheKey key = getCacheKeyForObjectForLock(primaryKey, object.getClass(), descriptor); if (key == null) { throw QueryException.objectDoesNotExistInCache(object); } return descriptor.getCacheInvalidationPolicy().getRemainingValidTime(key); }
/** * ADVANCED: * Return the remaining life of this object. This method is associated with use of * cache invalidation and returns the difference between the next expiry * time of the object and its read time. The method will return 0 for invalidated objects. */ public long getRemainingValidTime(Object object) { Vector primaryKey = getSession().keyFromObject(object); ClassDescriptor descriptor = getSession().getDescriptor(object); CacheKey key = getCacheKeyForObjectForLock(primaryKey, object.getClass(), descriptor); if (key == null) { throw QueryException.objectDoesNotExistInCache(object); } return descriptor.getCacheInvalidationPolicy().getRemainingValidTime(key); }
/** * ADVANCED: * Return the remaining life of this object. This method is associated with use of * cache invalidation and returns the difference between the next expiry * time of the object and its read time. The method will return 0 for invalidated objects. */ public long getRemainingValidTime(Object object) { Object primaryKey = getSession().getId(object); ClassDescriptor descriptor = getSession().getDescriptor(object); CacheKey key = getCacheKeyForObjectForLock(primaryKey, object.getClass(), descriptor); if (key == null) { throw QueryException.objectDoesNotExistInCache(object); } return descriptor.getCacheInvalidationPolicy().getRemainingValidTime(key); }