FOUR-20467 implement a caching system for settings by devmiguelangel · Pull Request #7779 · ProcessMaker/processmaker

Conversation

@devmiguelangel

Issue & Reproduction Steps

Implement a Caching System for Settings

Solution

  • Add the CacheInterface interface
  • Add the SettingCacheManager class
  • Add the SettingCacheFacade facade
  • Register the facade in ProcessMakerServiceProvider.php

Related Tickets & Packages

FOUR-20467

Code Review Checklist

  • I have pulled this code locally and tested it on my instance, along with any associated packages.
  • This code adheres to ProcessMaker Coding Guidelines.
  • This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • This solution fixes the bug reported in the original ticket.
  • This solution does not alter the expected output of a component in a way that would break existing Processes.
  • This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • This ticket conforms to the PRD associated with this part of ProcessMaker.

rodriquelca

*/
public function get(string $key, mixed $default = null): mixed
{
return $this->cacheManager->get($key, $default);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

improve with error handling example

try {
 return $this->cache->get($key, $default);
    } catch (\Exception $e) {
        // Log the error
        \Log::error("Cache get error: " . $e->getMessage());
        return $default;
    }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error handling was added

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, there is a ticket FOUR-20909 to go deeper into it.

rodriquelca