예제 #1
0
 /**
  * @param usedRate must be power of 2 minus 1, and it determines the likelihood that calling the
  *     used method actually moves the node in the usage list. The higher the used rate value, the
  *     less likely that calling the used method does anything. The used rate value should be
  *     proportional to the total cache size. For larger caches, exact MRU ordering is less
  *     critical, and the cost of updating the ordering is also higher. Hence, a larger used rate
  *     value is recommended.
  */
 NodeUsageList(LocalDatabase db, long usedRate, int maxSize) {
   if (maxSize <= 0) {
     throw new IllegalArgumentException();
   }
   mDatabase = db;
   mPageSize = db.pageSize();
   mUsedRate = usedRate;
   acquireExclusive();
   mMaxSize = maxSize;
   releaseExclusive();
 }