Return the size of redis db.
@param pattern key pattern
@return key-value size
516997
@Override
    public Long dbSize(byte[] pattern) {
        long dbSize = 0L;
        Jedis jedis = getJedis();
        try {
            ScanParams params = new ScanParams();
            params.count(count);
            params.match(pattern);
            byte[] cursor = ScanParams.SCAN_POINTER_START_BINARY;
            ScanResult<byte[]> scanResult;
            do {
                scanResult = jedis.scan(cursor, params);
                List<byte[]> results = scanResult.getResult();
                for (byte[] result : results) {
                    dbSize++;
                }
                cursor = scanResult.getCursorAsBytes();
            } while (scanResult.getStringCursor().compareTo(ScanParams.SCAN_POINTER_START) > 0);
        } finally {
            jedis.close();
        }
        return dbSize;
    }
1236795
public function getNestedFileCount( $pattern = NULL )
	{
		$count	= 0;
		foreach( $this->getNestedFileList( $pattern ) as $entry )
			$count++;
		return $count;
	}
523317
@Monitor(name = "batcherQueueSize", type = DataSourceType.GAUGE)
    public int getSize() {
        if (queue != null) {
            return queue.size();
        } else {
            return 0;
        }
    }
906285
public long sizeOf()
    {
        return INSTANCE_SIZE + SizeOf.sizeOf(key) + SizeOf.sizeOf(value) + SizeOf.sizeOf(used);
    }
298784
private int calculateTableSize(Object id, int size) {
        final String methodName = "calculateTableSize()";
        int tableSize = initial_valueset_size;
        boolean finish = false;
        do {
            if (size > tableSize) {
                tableSize = (tableSize * 2) + 1;
            } else {
                float ratio = (float) tableSize / (float) size;
                if (ratio < 1.5) {
                    tableSize = (tableSize * 2) + 1;
                }
                finish = true;
            }
        } while (finish == false);
        if (tc.isDebugEnabled())
            Tr.debug(tc, methodName, "cacheName=" + this.cacheName + " id=" + id + " size=" + size + " tableSize=" + tableSize);
        return tableSize;
    }
339877
public function getCount( $pattern = NULL )
	{
		$count	= 0;
		$list	= $this->getList( $pattern );
		foreach( $list as $entry )
			$count++;
		return $count;
	}
208447
static int getSize(Object agg) throws JMFSchemaViolationException {
    if (agg == null) {
      return 0;
    }
    else if (agg instanceof Collection) {
      return ((Collection)agg).size();
    }
    else if (agg.getClass().isArray()) {
      return Array.getLength(agg);
    }
    else {
      throw new JMFSchemaViolationException(agg.getClass().getName());
    }
  }
505504
@Override
    public <C extends Collection<?>> Expression<Integer> size(Expression<C> arg0)
    {
        // TODO Auto-generated method stub
        return null;
    }
544739
@Override
    public int size() {
        Map<String, GroovyRunner> map = getMap();
        readLock.lock();
        try {
            return map.size();
        } finally {
            readLock.unlock();
        }
    }
455043
def keys(pattern = SCAN_PATTERN, count = DEFAULT_COUNT)
      return redis(&:keys) if pattern.nil?

      redis { |conn| conn.scan_each(match: prefix(pattern), count: count).to_a }
    end
594307
Integer getDatabasePageSize(Class<? extends Storable> type) {
        if (mDatabasePageSizes == null) {
            return null;
        }
        Integer size = mDatabasePageSizes.get(type);
        if (size == null && type != null) {
            size = mDatabasePageSizes.get(null);
        }
        return size;
    }
1058727
protected Pattern[] queryDetectionPattern(final Pattern... pattern) {
        if (pattern == null) {
            throw new IllegalArgumentException();
        } // end of if

        // ---

        if (this.queryDetection == null) {
            return pattern;
        } // end of if

        // ---

        final Pattern[] patterns = 
            new Pattern[this.queryDetection.length + pattern.length];

        System.arraycopy(this.queryDetection, 0, 
                         patterns, 0, 
                         this.queryDetection.length);

        int i = this.queryDetection.length;

        for (final Pattern p : pattern) {
            patterns[i++] = p;
        } // end of for

        return patterns;
    }
519351
@Override
    public Long getRepositorySize() {
        try {

            LOGGER.debug("Calculating repository size from index");
            final Repository repo = getJcrRepository(repository);

            // Differentiating between the local getRepositorySize and
            // ServiceHelpers
            return ServiceHelpers.getRepositorySize(repo);
        } catch (final RepositoryException e) {
            throw new RepositoryRuntimeException(e);
        }
    }
995272
public static final String convertPattern(String pattern) {
        if (pattern == null) {
            return null;
        }
        else {
            String convertedPattern = pattern;
            for (PatternConverter converter : PATTERN_CONVERTERS) {
                convertedPattern = converter.convert(convertedPattern);
            }

            return convertedPattern;
        }
    }
545824
public static Format getDateFormatter(final String pattern) {
		Format format = JKFormatUtil.formatMap.get(pattern);
		if (format == null) {
			format = new SimpleDateFormat(pattern);
			JKFormatUtil.formatMap.put(pattern, format);
		}
		return format;
	}
1273967
public int getCacheIdsSize(boolean filter) {
        if (filter == CacheOnDisk.FILTER) {
            return htod.getCacheIdsSize(filter) - htod.invalidationBuffer.size();
        } else {
            return htod.getCacheIdsSize(filter);
        }

    }
935993
public synchronized long position(byte[] pattern, long start) throws SQLException {
    assertPosition(start, pattern.length);

    int position = 1;
    int patternIdx = 0;
    long result = -1;
    int tmpPosition = 1;

    for (LOIterator i = new LOIterator(start - 1); i.hasNext(); position++) {
      byte b = i.next();
      if (b == pattern[patternIdx]) {
        if (patternIdx == 0) {
          tmpPosition = position;
        }
        patternIdx++;
        if (patternIdx == pattern.length) {
          result = tmpPosition;
          break;
        }
      } else {
        patternIdx = 0;
      }
    }

    return result;
  }