Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
83ab6092
Commit
83ab6092
authored
Aug 15, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improving cache API documentation.
parent
f72171f6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
cache.php
system/cache.php
+24
-0
No files found.
system/cache.php
View file @
83ab6092
...
@@ -47,6 +47,22 @@ class Cache {
...
@@ -47,6 +47,22 @@ class Cache {
/**
/**
* Get an item from the cache.
* Get an item from the cache.
*
*
* If the cached item doesn't exist, the specified default value will be returned.
*
* <code>
* // Get the "name" item from the cache
* $name = Cache::get('name');
*
* // Get the "name" item, but return "Fred" if it doesn't exist
* $name = Cache::get('name', 'Fred');
* </code>
*
* The driver may also be specified:
*
* <code>
* $name = Cache::get('name', null, 'memcached');
* </code>
*
* @param string $key
* @param string $key
* @param mixed $default
* @param mixed $default
* @param string $driver
* @param string $driver
...
@@ -66,6 +82,14 @@ class Cache {
...
@@ -66,6 +82,14 @@ class Cache {
* Get an item from the cache. If the item doesn't exist in the cache, store
* Get an item from the cache. If the item doesn't exist in the cache, store
* the default value in the cache and return it.
* the default value in the cache and return it.
*
*
* <code>
* // Get the name item. If it doesn't exist, store "Fred" for 30 minutes
* $name = Cache::remember('name', 'Fred', 30);
*
* // Closures may also be used as default values
* $name = Cache::remember('votes', function() {return Vote::count();}, 30);
* </code>
*
* @param string $key
* @param string $key
* @param mixed $default
* @param mixed $default
* @param int $minutes
* @param int $minutes
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment