[5359] | 1 | <?php |
---|
| 2 | /** |
---|
| 3 | * |
---|
| 4 | * Copyright (C) 2011 Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) |
---|
| 5 | * |
---|
| 6 | * This program is free software; you can redistribute it and/or |
---|
| 7 | * modify it under the terms of the GNU General Public License |
---|
| 8 | * as published by the Free Software Foundation; either version 2 |
---|
| 9 | * of the License, or (at your option) any later version. |
---|
| 10 | * |
---|
| 11 | * This program is distributed in the hope that it will be useful, |
---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 14 | * GNU General Public License for more details. |
---|
| 15 | * |
---|
| 16 | * You should have received a copy of the GNU General Public License |
---|
| 17 | * along with this program; if not, write to the Free Software |
---|
| 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
| 19 | * |
---|
| 20 | * You can contact Prognus Software Livre headquarters at Av. Tancredo Neves, |
---|
| 21 | * 6731, PTI, Bl. 05, Esp. 02, Sl. 10, Foz do Iguaçu - PR - Brasil or at |
---|
| 22 | * e-mail address prognus@prognus.com.br. |
---|
| 23 | * |
---|
| 24 | * |
---|
| 25 | * @package MemCacheService |
---|
| 26 | * @license http://www.gnu.org/copyleft/gpl.html GPL |
---|
| 27 | * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) |
---|
| 28 | * @author Cristiano Corrêa Schmidt |
---|
| 29 | * @sponsor Caixa Econômica Federal |
---|
| 30 | * @version 1.0 |
---|
| 31 | * @since 2.4.0 |
---|
| 32 | */ |
---|
| 33 | class MemCacheService extends Memcache |
---|
| 34 | { |
---|
| 35 | var $expiration = 86400; |
---|
| 36 | |
---|
| 37 | /** |
---|
| 38 | * Adiciona objeto ao cache, com tratamento de erros no compress. |
---|
| 39 | * |
---|
| 40 | * @license http://www.gnu.org/copyleft/gpl.html GPL |
---|
| 41 | * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) |
---|
| 42 | * @sponsor Caixa Econômica Federal |
---|
| 43 | * @author Cristiano Corrêa Schmidt |
---|
| 44 | * @return bool |
---|
| 45 | * @access public |
---|
| 46 | */ |
---|
| 47 | public function set( $key, $value, $expiration = false) |
---|
| 48 | { |
---|
| 49 | return parent::set($key, |
---|
| 50 | $value, |
---|
| 51 | ( is_bool( $value ) || is_int( $value ) || is_float( $value ) ) ? false : MEMCACHE_COMPRESSED, |
---|
| 52 | ( $expiration !== false ) ? $expiration : $this->expiration ); |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | ServiceLocator::register( 'memCache', new MemCacheService() ); |
---|
| 58 | |
---|