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
117a4cb8
Commit
117a4cb8
authored
Dec 26, 2012
by
Bryan Wood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added wincache cache driver
parent
f25d09dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
0 deletions
+92
-0
cache.php
laravel/cache.php
+3
-0
wincache.php
laravel/cache/drivers/wincache.php
+89
-0
No files found.
laravel/cache.php
View file @
117a4cb8
...
...
@@ -79,6 +79,9 @@ class Cache {
case
'database'
:
return
new
Cache\Drivers\Database
(
Config
::
get
(
'cache.key'
));
case
'wincache'
:
return
new
Cache\Drivers\WinCache
(
Config
::
get
(
'cache.key'
));
default
:
throw
new
\Exception
(
"Cache driver
{
$driver
}
is not supported."
);
}
...
...
laravel/cache/drivers/wincache.php
0 → 100644
View file @
117a4cb8
<?php
namespace
Laravel\Cache\Drivers
;
class
WinCache
extends
Driver
{
/**
* The cache key from the cache configuration file.
*
* @var string
*/
protected
$key
;
/**
* Create a new WinCache cache driver instance.
*
* @param string $key
* @return void
*/
public
function
__construct
(
$key
)
{
$this
->
key
=
$key
;
}
/**
* Determine if an item exists in the cache.
*
* @param string $key
* @return bool
*/
public
function
has
(
$key
)
{
return
(
!
is_null
(
$this
->
get
(
$key
)));
}
/**
* Retrieve an item from the cache driver.
*
* @param string $key
* @return mixed
*/
protected
function
retrieve
(
$key
)
{
if
((
$cache
=
wincache_ucache_get
(
$this
->
key
.
$key
))
!==
false
)
{
return
$cache
;
}
}
/**
* Write an item to the cache for a given number of minutes.
*
* <code>
* // Put an item in the cache for 15 minutes
* Cache::put('name', 'Taylor', 15);
* </code>
*
* @param string $key
* @param mixed $value
* @param int $minutes
* @return void
*/
public
function
put
(
$key
,
$value
,
$minutes
)
{
wincache_ucache_add
(
$this
->
key
.
$key
,
$value
,
$minutes
*
60
);
}
/**
* Write an item to the cache that lasts forever.
*
* @param string $key
* @param mixed $value
* @return void
*/
public
function
forever
(
$key
,
$value
)
{
return
$this
->
put
(
$key
,
$value
,
0
);
}
/**
* Delete an item from the cache.
*
* @param string $key
* @return void
*/
public
function
forget
(
$key
)
{
wincache_ucache_delete
(
$this
->
key
.
$key
);
}
}
\ No newline at end of file
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