class LoginSummary extends Object
Value
for the "/user/EMAIL/-/login" Key
. Illustrates the
use of a Key/Value pair for a parent (non-leaf) Key
.
In general, be aware that there are performance trade-offs in
storing summary data, as shown in this example, versus computing it
using a query when it is needed. For example, we could avoid
storing totalLoginCount
and get the count of events
efficiently using a range query on the keys. But we would still
need to maintain the totalLoginDuration
if we wanted to
avoid accessing each LoginSession
to sum the individual
values on demand. In some cases, summary data may be expensive
enough to recompute that it's worth storing. This is a trade-off
that application designers need to make based upon their knowledge
of application access patterns.
Constructor and Description |
---|
LoginSummary(String email)
Constructs a user object with its unique identifier, the email address.
|
Modifier and Type | Method and Description |
---|---|
(package private) String |
getEmail()
Returns the email identifier.
|
(package private) Key |
getStoreKey()
Returns a Key that can be used to write or read the LoginSummary.
|
(package private) Value |
getStoreValue(Bindings bindings)
Serializes the summary attributes into the byte array of a Value.
|
(package private) int |
getTotalLoginCount()
Returns the total login count.
|
(package private) long |
getTotalLoginDuration()
Returns the total login duration.
|
(package private) void |
setStoreValue(Bindings bindings,
Value value)
Deserializes the summary attributes from the byte array of a Value.
|
(package private) void |
setTotalLoginCount(int totalLoginCount)
Changes the total login count.
|
(package private) void |
setTotalLoginDuration(long totalLoginDuration)
Changes the total login duration.
|
String |
toString() |
LoginSummary(String email)
String getEmail()
void setTotalLoginCount(int totalLoginCount)
int getTotalLoginCount()
void setTotalLoginDuration(long totalLoginDuration)
long getTotalLoginDuration()
Key getStoreKey()
Value getStoreValue(Bindings bindings)
void setStoreValue(Bindings bindings, Value value)
Copyright (c) 2011, 2015 Oracle and/or its affiliates. All rights reserved.