public class DiskUsageStatistics
extends java.lang.Object
getSummary(User)
only hits the database the first time the
method is called for a user. Use the reset()
method to clear
the internal cache.
You can control how long summaries are cached by setting a maximum age
with the setMaxAge(int)
method.
DiskUsage.getStatistics(DbControl)
Modifier and Type | Class and Description |
---|---|
class |
DiskUsageStatistics.Summary
Holds summary disk usage information for the total disk usage or for
a specific user or group.
|
Modifier and Type | Field and Description |
---|---|
private DbControl |
dc |
private int |
maxAge |
private java.util.List<QuotaType> |
quotaTypes |
private java.util.Map<java.lang.Object,DiskUsageStatistics.Summary> |
summaries |
private static java.lang.Long |
ZERO |
Constructor and Description |
---|
DiskUsageStatistics(DbControl dc)
Create a new disk usage statistics object.
|
Modifier and Type | Method and Description |
---|---|
int |
getMaxAge()
Get the max age in seconds for a disk usage summary
object before it is reloaded from the database again.
|
java.util.List<QuotaType> |
getQuotaTypes()
Get the list of quota types that are registered for
DiskConsumable
items. |
DiskUsageStatistics.Summary |
getSummary(Group group)
Get a summary of the disk usage for the specified group.
|
DiskUsageStatistics.Summary |
getSummary(User user)
Get a summary of the disk usage for the specified user.
|
DiskUsageStatistics.Summary |
getTotalSummary()
Get a summary of the total disk usage.
|
void |
reset()
Reset the internal cache of already loaded statistics.
|
void |
setDbControl(DbControl dc)
Set the DbControl which will be used to get statisics if it is not
cached.
|
void |
setMaxAge(int maxAge)
Set the max age in seconds for a disk usage summary
object before it is reloaded from the database again.
|
private static final java.lang.Long ZERO
private DbControl dc
private java.util.Map<java.lang.Object,DiskUsageStatistics.Summary> summaries
private java.util.List<QuotaType> quotaTypes
private int maxAge
DiskUsageStatistics(DbControl dc)
public void setDbControl(DbControl dc)
dc
- An open DbControl objectpublic void setMaxAge(int maxAge)
maxAge
- Number of seconds to keep summary in the cache,
or zero to disable the cache or a negative value to cache
foreverpublic int getMaxAge()
public void reset()
public java.util.List<QuotaType> getQuotaTypes()
DiskConsumable
items.public DiskUsageStatistics.Summary getTotalSummary()
public DiskUsageStatistics.Summary getSummary(User user)
user
- The user to get the disk usage forpublic DiskUsageStatistics.Summary getSummary(Group group)
group
- The group to get the disk usage for