Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
cmatosbc authored Nov 4, 2024
1 parent c795ac9 commit da951c4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,15 @@ $result = $cachedStaticMethod([MyClass::class, 'staticMethod'], 'arg1', 'arg2');
* Reducing Server Load: Offload processing to the cache, especially for computationally expensive tasks.

By using these functions, you can significantly improve the performance of your WordPress applications.

## JS like syntax:

A JS like syntax can also be used with PHP closures, so the next arguments can be passed directly to the Closure, like this.

```php
// Cache a custom function for 5 minutes
$expireTime = new DateTime('+5 minutes');
$result = withCache($cache, $expireTime)(function () {
return 'Hello, world!';
});
```

0 comments on commit da951c4

Please sign in to comment.