Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
core_course\local\repository\caching_content_item_readonly_repository Class Reference

The class caching_content_item_repository, for fetching content_items, with additional caching. More...

Inheritance diagram for core_course\local\repository\caching_content_item_readonly_repository:
core_course\local\repository\content_item_readonly_repository_interface

Public Member Functions

 __construct (\cache $cachestore, content_item_readonly_repository $contentitemrepository)
 The caching_content_item_readonly_repository constructor.
 
 find_all ()
 Find all the content items made available by core and plugins.
 
 find_all_for_course (\stdClass $course, stdClass $user)
 Find all the content items for a given course and user.
 

Detailed Description

The class caching_content_item_repository, for fetching content_items, with additional caching.

This class decorates the content_item_repository and uses the supplied cache to store content items for user and course combinations. The content items for subsequent calls are returned from the cache if present, else are retrieved from the wrapped content_item_repository.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

core_course\local\repository\caching_content_item_readonly_repository::__construct ( \cache $cachestore,
content_item_readonly_repository $contentitemrepository )

The caching_content_item_readonly_repository constructor.

Parameters
cache$cachestorea cache to use.
content_item_readonly_repository$contentitemrepositorythe repository to use as a fallback, after a cache miss.

Member Function Documentation

◆ find_all()

core_course\local\repository\caching_content_item_readonly_repository::find_all ( )

Find all the content items made available by core and plugins.

Return values
array

Implements core_course\local\repository\content_item_readonly_repository_interface.

◆ find_all_for_course()

core_course\local\repository\caching_content_item_readonly_repository::find_all_for_course ( \stdClass $course,
stdClass $user )

Find all the content items for a given course and user.

Parameters
stdClass$courseThe course to find content items for.
stdClass$userthe user to pass to plugins.
Return values
arraythe array of content items.

Implements core_course\local\repository\content_item_readonly_repository_interface.


The documentation for this class was generated from the following file: