ConfigProvider.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * This file is part of Hyperf.
  5. *
  6. * @link https://www.hyperf.io
  7. * @document https://hyperf.wiki
  8. * @contact group@hyperf.io
  9. * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
  10. */
  11. namespace Hyperf\Cache;
  12. use Hyperf\Cache\Aspect\CacheableAspect;
  13. use Hyperf\Cache\Aspect\CacheAheadAspect;
  14. use Hyperf\Cache\Aspect\CacheEvictAspect;
  15. use Hyperf\Cache\Aspect\CachePutAspect;
  16. use Hyperf\Cache\Aspect\FailCacheAspect;
  17. use Hyperf\Cache\Listener\DeleteListener;
  18. use Psr\SimpleCache\CacheInterface;
  19. class ConfigProvider
  20. {
  21. public function __invoke(): array
  22. {
  23. return [
  24. 'dependencies' => [
  25. CacheInterface::class => Cache::class,
  26. ],
  27. 'listeners' => [
  28. DeleteListener::class,
  29. ],
  30. 'annotations' => [
  31. 'scan' => [
  32. 'collectors' => [
  33. CacheListenerCollector::class,
  34. ],
  35. ],
  36. ],
  37. 'aspects' => [
  38. CacheableAspect::class,
  39. CacheAheadAspect::class,
  40. CacheEvictAspect::class,
  41. CachePutAspect::class,
  42. FailCacheAspect::class,
  43. ],
  44. 'publish' => [
  45. [
  46. 'id' => 'config',
  47. 'description' => 'The config for cache.',
  48. 'source' => __DIR__ . '/../publish/cache.php',
  49. 'destination' => BASE_PATH . '/config/autoload/cache.php',
  50. ],
  51. ],
  52. ];
  53. }
  54. }