| 
    Moodle PHP Documentation 4.1
    
   Moodle 4.1dev (Build: 20220512) (5e5e12e0) 
   | 
 
Cacheable object. More...
  
Public Member Functions | |
| prepare_to_cache () | |
| Prepares the object for caching.  More... | |
Static Public Member Functions | |
| static | wake_from_cache ($data) | 
| Takes the data provided by prepare_to_cache and reinitialises an instance of the associated from it.  More... | |
Cacheable object.
This interface can be implemented by any class that is going to be passed into a cache and allows it to take control of the structure and the information about to be cached, as well as how to deal with it when it is retrieved from a cache. Think of it like serialisation and the __sleep and __wakeup methods. This is used because cache stores are responsible for how they interact with data and what they do when storing it. This interface ensures there is always a guaranteed action.
| cacheable_object::prepare_to_cache | ( | ) | 
Prepares the object for caching.
Works like the __sleep method.
| mixed | The data to cache, can be anything except a class that implements the cacheable_object... that would be dumb. | 
Implemented in core_course_category, repository_type, and repository.
      
  | 
  static | 
Takes the data provided by prepare_to_cache and reinitialises an instance of the associated from it.
| mixed | $data | 
| object | The instance for the given data. | 
Implemented in core_course_category, repository_type, and repository.