]>
Commit | Line | Data |
---|---|---|
7c673cae | 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. |
11fdf7f2 TL |
2 | // This source code is licensed under both the GPLv2 (found in the |
3 | // COPYING file in the root directory) and Apache 2.0 License | |
4 | // (found in the LICENSE.Apache file in the root directory). | |
7c673cae FG |
5 | |
6 | package org.rocksdb; | |
7 | ||
8 | ||
9 | public abstract class Cache extends RocksObject { | |
10 | protected Cache(final long nativeHandle) { | |
11 | super(nativeHandle); | |
12 | } | |
1e59de90 TL |
13 | |
14 | /** | |
15 | * Returns the memory size for the entries | |
16 | * residing in cache. | |
17 | * | |
18 | * @return cache usage size. | |
19 | * | |
20 | */ | |
21 | public long getUsage() { | |
22 | assert (isOwningHandle()); | |
23 | return getUsage(this.nativeHandle_); | |
24 | } | |
25 | ||
26 | /** | |
27 | * Returns the memory size for the entries | |
28 | * being pinned in cache. | |
29 | * | |
30 | * @return cache pinned usage size. | |
31 | * | |
32 | */ | |
33 | public long getPinnedUsage() { | |
34 | assert (isOwningHandle()); | |
35 | return getPinnedUsage(this.nativeHandle_); | |
36 | } | |
37 | ||
38 | private native static long getUsage(final long handle); | |
39 | private native static long getPinnedUsage(final long handle); | |
7c673cae | 40 | } |