-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmemcache.php
More file actions
32 lines (30 loc) · 994 Bytes
/
Copy pathmemcache.php
File metadata and controls
32 lines (30 loc) · 994 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/**
* Description of memcache
* Php 7.0.23 memcache
* @author o.kesmez
*/
class _memcache {
private $memcache;
//Yapıcı fonksiyonumuzu kullanarak memcache servisine bağlanıyoruz.
public function __construct() {
$this->memcache = new Memcache;
$this->memcache->connect("localhost",11211);
}
//Memcache içerisinde tutulacak data ayarlanıyor.
/*
* $param time => saniye cinsinden cache süresi
* $param key => hangi anahtar değeri ile cache içerisinde tutulacağını belirtir
* $param value => cache içerisine alınacak olan değeri belirtir.
*/
public function setData($key,$value=null,$time) {
$this->memcache->set($key,$value,false,$time);
}
//Memcache içerisinden data alınıyor
/*
* $param key => verilen anahtara ait cache değerini döner.
*/
public function getData($key) {
return $this->memcache->get($key);
}
}