Add a cache for prisoners online only, this should help performance #26

The cache listens to a lot of events and custom events to ensure the
cache is up to date, this way we don't have to loop through all the
prisoners in a jail every single time they move or something but instead
just check the cache.
This commit is contained in:
graywolf336
2014-05-30 12:23:32 -05:00
parent 82f17f3a4b
commit af1fa37470
5 changed files with 144 additions and 3 deletions

View File

@ -0,0 +1,28 @@
package com.graywolf336.jail.beans;
/**
* An object for storing online cached prisoners.
*
* @author graywolf336
* @since 3.0.0
* @version 1.0.0
*/
public class CachePrisoner {
private Jail jail;
private Prisoner p;
public CachePrisoner(Jail jail, Prisoner prisoner) {
this.jail = jail;
this.p = prisoner;
}
/** Gets the Jail this cache is in. */
public Jail getJail() {
return this.jail;
}
/** Gets the Prisoner in this cache. */
public Prisoner getPrisoner() {
return this.p;
}
}