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:
28
src/main/java/com/graywolf336/jail/beans/CachePrisoner.java
Normal file
28
src/main/java/com/graywolf336/jail/beans/CachePrisoner.java
Normal 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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user