https://github.com/kupietools/ktwp-wp-plugin-caching-toolkit
A plugin providing functions for WordPress developers to implement PHP function caching for performance.
https://github.com/kupietools/ktwp-wp-plugin-caching-toolkit
utility-functions wordpress wordpress-development wordpress-performance wordpress-plugin wordpress-plugin-development wordpress-theme-development
Last synced: about 2 months ago
JSON representation
A plugin providing functions for WordPress developers to implement PHP function caching for performance.
- Host: GitHub
- URL: https://github.com/kupietools/ktwp-wp-plugin-caching-toolkit
- Owner: kupietools
- License: gpl-3.0
- Created: 2025-04-15T23:23:20.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-09-01T00:53:22.000Z (9 months ago)
- Last Synced: 2025-10-07T17:38:07.164Z (8 months ago)
- Topics: utility-functions, wordpress, wordpress-development, wordpress-performance, wordpress-plugin, wordpress-plugin-development, wordpress-theme-development
- Language: PHP
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# KupieTools Caching Toolkit
A powerful WordPress plugin that provides a framework for developers to implement function caching for dramatic performance improvements. This toolkit intelligently caches function results and automatically clears those caches when content changes.
## Features
- Function result caching with automatic invalidation
- Configurable cache invalidation triggers
- Integration with WordPress core hooks for cache management
- Admin interface under the KupieTools menu
- Optimized for performance with minimal overhead
- Uses WordPress transients and object cache for maximum compatibility
- Developer-friendly API for implementing caching in custom code
## Core Functions
### For Developers
- `getFunctionTransient($functionName, $arguments=[], $manualClearOnly=false)` - Retrieve cached function results
- `setFunctionTransient($functionName, $value, $arguments=[])` - Cache function results
- `hashArguments($arguments)` - Utility function to create consistent hashes of function arguments
### Cache Invalidation
The plugin intelligently clears caches when content changes, with configurable triggers for:
- Post saving/updating
- Category/taxonomy creation, editing, and deletion
- Post trashing
- Theme and plugin file editing
## Configuration Options
In the WordPress admin panel under KupieTools:
- Enable/disable cache clearing for different WordPress actions
- Configure cache behaviors for different types of content updates
- Special handling for theme/plugin file editing
## Benefits
- Dramatically improves performance for expensive function calls
- Reduces database queries and server processing time
- Intelligent cache invalidation means content stays fresh
- No manual cache management required - it all happens automatically
- Preserves dynamic content functionality while improving speed
## For WordPress Developers
```php
// Example usage in your theme or plugin:
function my_expensive_function($param1, $param2) {
// Check if we have a cached result
$cached = getFunctionTransient('my_expensive_function', [$param1, $param2]);
if ($cached !== null) {
return $cached;
}
// If not cached, do the expensive operation
$result = // ... expensive operations ...
// Cache the result for future use
setFunctionTransient('my_expensive_function', $result, [$param1, $param2]);
return $result;
}
```
## Installation
1. Upload the plugin files to the `/wp-content/plugins/ktwp-caching-toolkit` directory
2. Activate the plugin through the WordPress admin interface
3. Configure settings under the KupieTools menu in WordPress admin
## License
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.