|
729 | 729 | */ |
730 | 730 | 'enabled' => env('FILTERABLE_EVENTS_ENABLED', true), |
731 | 731 | ], |
| 732 | + |
| 733 | + /* |
| 734 | + |-------------------------------------------------------------------------- |
| 735 | + | Caching System |
| 736 | + |-------------------------------------------------------------------------- |
| 737 | + | |
| 738 | + | Configure the filterable caching system, which intelligently caches |
| 739 | + | filtered query results to improve performance for frequently-used filters. |
| 740 | + | |
| 741 | + */ |
| 742 | + 'cache' => [ |
| 743 | + |
| 744 | + /* |
| 745 | + |-------------------------------------------------------------------------- |
| 746 | + | Enable or Disable Caching |
| 747 | + |-------------------------------------------------------------------------- |
| 748 | + | |
| 749 | + | This option allows you to enable or disable the caching system globally. |
| 750 | + | When disabled, no caching will occur even if explicitly requested in code. |
| 751 | + | |
| 752 | + */ |
| 753 | + 'enabled' => env('FILTERABLE_CACHE_ENABLED', true), |
| 754 | + |
| 755 | + /* |
| 756 | + |-------------------------------------------------------------------------- |
| 757 | + | Default Cache Driver |
| 758 | + |-------------------------------------------------------------------------- |
| 759 | + | |
| 760 | + | The cache driver to use for storing filterable results. |
| 761 | + | You can use any Laravel cache driver: redis, memcached, file, etc. |
| 762 | + | Defaults to the application's default cache driver if not specified. |
| 763 | + | |
| 764 | + */ |
| 765 | + 'driver' => env('FILTERABLE_CACHE_DRIVER', null), |
| 766 | + |
| 767 | + /* |
| 768 | + |-------------------------------------------------------------------------- |
| 769 | + | Default Cache TTL (Time To Live) |
| 770 | + |-------------------------------------------------------------------------- |
| 771 | + | |
| 772 | + | The default time in seconds that cached results will be stored. |
| 773 | + | This can be overridden on a per-filter basis using cache($ttl). |
| 774 | + | |
| 775 | + */ |
| 776 | + 'default_ttl' => env('FILTERABLE_CACHE_TTL', 3600), // 1 hour |
| 777 | + |
| 778 | + /* |
| 779 | + |-------------------------------------------------------------------------- |
| 780 | + | Cache Key Prefix |
| 781 | + |-------------------------------------------------------------------------- |
| 782 | + | |
| 783 | + | A prefix prepended to all cache keys generated by the filterable system. |
| 784 | + | This helps organize cache entries and avoid key collisions. |
| 785 | + | |
| 786 | + */ |
| 787 | + 'prefix' => env('FILTERABLE_CACHE_PREFIX', 'filterable'), |
| 788 | + |
| 789 | + /* |
| 790 | + |-------------------------------------------------------------------------- |
| 791 | + | Cache Key Version |
| 792 | + |-------------------------------------------------------------------------- |
| 793 | + | |
| 794 | + | A version string included in cache keys. Increment this to invalidate |
| 795 | + | all existing cached entries after deploying breaking changes to filters. |
| 796 | + | |
| 797 | + */ |
| 798 | + 'version' => env('FILTERABLE_CACHE_VERSION', 'v1'), |
| 799 | + |
| 800 | + /* |
| 801 | + |-------------------------------------------------------------------------- |
| 802 | + | Cache Profiles |
| 803 | + |-------------------------------------------------------------------------- |
| 804 | + | |
| 805 | + | Define reusable cache profiles with predefined TTL and tags. |
| 806 | + | These can be used via cacheProfile('profile_name') for consistency. |
| 807 | + | |
| 808 | + | Example: |
| 809 | + | 'profiles' => [ |
| 810 | + | 'heavy_reports' => [ |
| 811 | + | 'ttl' => 7200, |
| 812 | + | 'tags' => ['reports', 'analytics'], |
| 813 | + | ], |
| 814 | + | 'quick_filters' => [ |
| 815 | + | 'ttl' => 300, |
| 816 | + | 'tags' => ['filters'], |
| 817 | + | ], |
| 818 | + | ], |
| 819 | + | |
| 820 | + */ |
| 821 | + 'profiles' => [ |
| 822 | + // Define your cache profiles here |
| 823 | + ], |
| 824 | + |
| 825 | + /* |
| 826 | + |-------------------------------------------------------------------------- |
| 827 | + | Auto-Invalidation |
| 828 | + |-------------------------------------------------------------------------- |
| 829 | + | |
| 830 | + | Automatically invalidate cached results when related models are modified. |
| 831 | + | Maps model classes to cache tags that should be flushed on changes. |
| 832 | + | |
| 833 | + | Example: |
| 834 | + | 'auto_invalidate' => [ |
| 835 | + | 'enabled' => true, |
| 836 | + | 'models' => [ |
| 837 | + | App\Models\Post::class => ['posts', 'content'], |
| 838 | + | App\Models\User::class => ['users'], |
| 839 | + | ], |
| 840 | + | ], |
| 841 | + | |
| 842 | + */ |
| 843 | + 'auto_invalidate' => [ |
| 844 | + 'enabled' => env('FILTERABLE_AUTO_INVALIDATE', false), |
| 845 | + 'models' => [ |
| 846 | + // Define model-to-tags mappings here |
| 847 | + ], |
| 848 | + ], |
| 849 | + |
| 850 | + /* |
| 851 | + |-------------------------------------------------------------------------- |
| 852 | + | Cache Tracking |
| 853 | + |-------------------------------------------------------------------------- |
| 854 | + | |
| 855 | + | Enable tracking of cache hit/miss statistics for monitoring and |
| 856 | + | performance optimization. Requires profiler to be enabled. |
| 857 | + | |
| 858 | + */ |
| 859 | + 'tracking' => [ |
| 860 | + 'enabled' => env('FILTERABLE_CACHE_TRACKING', false), |
| 861 | + 'log_channel' => env('FILTERABLE_CACHE_LOG_CHANNEL', 'daily'), |
| 862 | + ], |
| 863 | + ], |
732 | 864 | ]; |
0 commit comments