Class PageCache<T>

  • public class PageCache<T>
    extends Object
    PageCache encapsulates and synchronizes all accesses to the cache.
    Hendrik Schreiber
    • Method Detail

      • getAll

        public List<T> getAll()
      • update

        public void update​(T persistentObject)
      • getId

        public Long getId​(int index)
      • get

        public T get​(int index)
        This method might open and close its own session/transactions. It's therefore not recommended to call it from within your own transaction.
        index - index
      • reverseDirection

        public void reverseDirection()
      • clear

        public void clear()
        Completely clears this cache.
      • clearOrder

        public void clearOrder()
        Clears just the order the cached items are in, but possibly still maintains copy of song objects.
        See Also:
      • indexOf

        public int indexOf​(T object)
      • indexOf

        public int indexOf​(long id)
      • removeFirstCached

        public void removeFirstCached()
      • removeFromIndex

        public void removeFromIndex​(T persistentObject)
      • remove

        public void remove​(int... indices)
        Remove the entries with the given indices from the cache.
        indices - indices
      • add

        public void add​(long[] ids)
        Add entries to this cache. Only makes sense, if the cache is in its natural order.
        ids - ids to add at the end
      • add

        public void add​(int index,
                        long[] ids)
        Add entries to this cache. Only makes sense, if the cache is in its natural order.
        index - where to insert the ids
        ids - ids to add at the end
      • removeIndices

        public static long[] removeIndices​(long[] array,
                                           int... sortedIndicesToRemove)
        Remove indices from an array. The indices have to be sorted ascendingly.
        array - array
        sortedIndicesToRemove - sorted indices (asc)
        new array with the given indices removed
      • getPageSize

        public int getPageSize()
      • setPageSize

        public void setPageSize​(int pageSize)
      • isUseDirectQuery

        public boolean isUseDirectQuery()
      • setUseDirectQuery

        public void setUseDirectQuery​(boolean useDirectQuery)
      • isAsyncLoading

        public boolean isAsyncLoading()
      • setAsyncLoading

        public void setAsyncLoading​(boolean asyncLoading)