@SuppressWarnings("unchecked") public CacheLIRS(long maxMemory,int segmentCount,int stackMoveDistance){
  setMaxMemory(maxMemory);
  if (Integer.bitCount(segmentCount) != 1) {
    throw new IllegalArgumentException("The segment count must be a power of 2, is " + segmentCount);
  }
  this.segmentCount=segmentCount;
  this.segmentMask=segmentCount - 1;
  this.stackMoveDistance=stackMoveDistance;
  segments=new Segment[segmentCount];
  clear();
  this.segmentShift=32 - Integer.bitCount(segmentMask);
}

@ SuppressWarnings ( "unchecked" ) public CacheLIRS ( long maxMemory , int segmentCount , int stackMoveDistance ) { setMaxMemory ( maxMemory ) ; if ( Integer . bitCount ( segmentCount ) != 1 ) { throw new IllegalArgumentException ( "The segment count must be a power of 2, is " + segmentCount ) ; } this . segmentCount = segmentCount ; this . segmentMask = segmentCount - 1 ; this . stackMoveDistance = stackMoveDistance ; segments = new Segment [ segmentCount ] ; clear ( ) ; this . segmentShift = 32 - Integer . bitCount ( segmentMask ) ; }
create a new cache with the given memory size .
