Panda3D
Public Member Functions | List of all members
SimpleLru Class Reference

An implementation of a very simple LRU algorithm. More...

Inheritance diagram for SimpleLru:
Namable

Public Member Functions

 __init__ (str name, int max_size)
 
 beginEpoch ()
 Marks the end of the previous epoch and the beginning of the next one. More...
 
 considerEvict ()
 Evicts a sequence of objects if the queue is full. More...
 
int countActiveSize ()
 Returns the total size of the pages that were enqueued since the last call to begin_epoch(). More...
 
 evictTo (int target_size)
 Evicts a sequence of objects until the queue fits within the indicated target size, regardless of its normal max size. More...
 
int getMaxSize ()
 Returns the max size of all objects that are allowed to be active on the LRU. More...
 
int getTotalSize ()
 Returns the total size of all objects currently active on the LRU. More...
 
 output (Ostream out)
 
 setMaxSize (int max_size)
 Changes the max size of all objects that are allowed to be active on the LRU. More...
 
bool validate ()
 Checks that the LRU is internally self-consistent. More...
 
 write (Ostream out, int indent_level)
 
- Public Member Functions inherited from Namable
 __init__ (const Namable)
 
 __init__ (str initial_name)
 
 clearName ()
 Resets the Namable's name to empty. More...
 
str getName ()
 
bool hasName ()
 Returns true if the Namable has a nonempty name set, false if the name is empty. More...
 
 output (Ostream out)
 Outputs the Namable. More...
 
 setName (str name)
 

Additional Inherited Members

- Static Public Member Functions inherited from Namable
static TypeHandle getClassType ()
 
- Public Attributes inherited from Namable
const String name
 

Detailed Description

An implementation of a very simple LRU algorithm.

Also see AdaptiveLru.

Member Function Documentation

◆ __init__()

__init__ ( str  name,
int  max_size 
)

◆ beginEpoch()

beginEpoch ( )

Marks the end of the previous epoch and the beginning of the next one.

This will evict any objects that are pending eviction, and also update any internal bookkeeping.

◆ considerEvict()

considerEvict ( )

Evicts a sequence of objects if the queue is full.

◆ countActiveSize()

int countActiveSize ( )

Returns the total size of the pages that were enqueued since the last call to begin_epoch().

◆ evictTo()

evictTo ( int  target_size)

Evicts a sequence of objects until the queue fits within the indicated target size, regardless of its normal max size.

◆ getMaxSize()

int getMaxSize ( )

Returns the max size of all objects that are allowed to be active on the LRU.

◆ getTotalSize()

int getTotalSize ( )

Returns the total size of all objects currently active on the LRU.

◆ output()

output ( Ostream  out)

◆ setMaxSize()

setMaxSize ( int  max_size)

Changes the max size of all objects that are allowed to be active on the LRU.

If the size is (size_t)-1, there is no limit.

◆ validate()

bool validate ( )

Checks that the LRU is internally self-consistent.

Returns true if successful, false if there is some problem.

◆ write()

write ( Ostream  out,
int  indent_level 
)