Class PageCache<T>


  • public class PageCache<T>
    extends Object
    PageCache encapsulates and synchronizes all accesses to the cache.
    Author:
    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.
        Parameters:
        index - index
        Returns:
        object
      • 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:
        clear()
      • 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.
        Parameters:
        indices - indices
      • add

        public void add​(long[] ids)
        Add entries to this cache. Only makes sense, if the cache is in its natural order.
        Parameters:
        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.
        Parameters:
        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.
        Parameters:
        array - array
        sortedIndicesToRemove - sorted indices (asc)
        Returns:
        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)