JFACTORY-GETCACHE-001
JFactory::getCache()
Factory::getCache()
getCache() is a service locator. Joomla 4+ wants the cache controller factory.
JFactory::getCache() → Cache controller from the container
What you will see
- Factory::getCache is deprecated
Symptoms people search
getCache deprecation
Replace this code
Swap JFactory::getCache() for Cache controller from the container.
Joomla 3
Remove or stop calling this
$cache = JFactory::getCache('com_lms', 'output');Joomla 4 / 6
Use this instead
$cache = Factory::getContainer()->get(\Joomla\CMS\Cache\CacheControllerFactoryInterface::class)
->createCacheController('output', ['defaultgroup' => 'com_lms']);How to fix it
- 1Resolve CacheControllerFactoryInterface from the container.
Also known as
getCache
Related issues
- Joomla 3 → 4Joomla API
JRequest::getVar() and the whole JRequest API
JRequest::getVar() → $app->getInput()->get('id')
- Joomla 3 → 4Joomla API
JError / JException
JError::raiseError() → throw new RuntimeException() / try-catch
- Joomla 3 → 4Joomla API
isAdmin() / isSite()
$app->isAdmin() → $app->isClient('administrator') / isClient('site')
- Joomla 3 → 4Joomla API
Factory::getUri()
JFactory::getUri() → Uri::getInstance()
- Joomla 3 → 4Joomla API
Factory::getXml() / JXMLElement
JFactory::getXML() → SimpleXMLElement
- Joomla 3 → 4Joomla API
Factory::getEditor()
JFactory::getEditor() → Editor::getInstance()