text: 
  #ifdef HAVE_CONFIG_H
  #include "../../../../ext_config.h"
  #endif
  
  #include <php.h>
  #include "../../../../php_ext.h"
  #include "../../../../ext.h"
  
  #include <Zend/zend_operators.h>
  #include <Zend/zend_exceptions.h>
  #include <Zend/zend_interfaces.h>
  
  #include "kernel/main.h"
  #include "kernel/array.h"
  #include "kernel/object.h"
  #include "kernel/memory.h"
  #include "kernel/concat.h"
  #include "kernel/fcall.h"
  #include "ext/spl/spl_exceptions.h"
  #include "kernel/exception.h"
  #include "kernel/operators.h"
  
  
  /**
   * This file is part of the Phalcon Framework.
   *
   * (c) Phalcon Team <team@phalconphp.com>
   *
   * For the full copyright and license information, please view the LICENSE.txt
   * file that was distributed with this source code.
   */
  /**
   * Phalcon\Mvc\Model\MetaData\Apcu
   *
   * Stores model meta-data in the APCu cache. Data will erased if the web server is restarted
   *
   * By default meta-data is stored for 48 hours (172800 seconds)
   *
   * You can query the meta-data by printing apcu_fetch('$PMM$') or apcu_fetch('$PMM$my-app-id')
   *
   *<code>
   * $metaData = new \Phalcon\Mvc\Model\Metadata\Apcu(
   *     [
   *         "prefix"   => "my-app-id",
   *         "lifetime" => 86400,
   *     ]
   * );
   *</code>
   */
  ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_MetaData_Apcu) {
  
  	ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model\\MetaData, Apcu, phalcon, mvc_model_metadata_apcu, phalcon_mvc_model_metadata_ce, phalcon_mvc_model_metadata_apcu_method_entry, 0);
  
  	zend_declare_property_string(phalcon_mvc_model_metadata_apcu_ce, SL("_prefix"), "", ZEND_ACC_PROTECTED TSRMLS_CC);
  
  	zend_declare_property_long(phalcon_mvc_model_metadata_apcu_ce, SL("_ttl"), 172800, ZEND_ACC_PROTECTED TSRMLS_CC);
  
  	zend_declare_property_null(phalcon_mvc_model_metadata_apcu_ce, SL("_metaData"), ZEND_ACC_PROTECTED TSRMLS_CC);
  
  	phalcon_mvc_model_metadata_apcu_ce->create_object = zephir_init_properties_Phalcon_Mvc_Model_MetaData_Apcu;
  	return SUCCESS;
  
  }
  
  /**
   * Phalcon\Mvc\Model\MetaData\Apcu constructor
   *
   * @param array options
   */
  PHP_METHOD(Phalcon_Mvc_Model_MetaData_Apcu, __construct) {
  
  	zval *options = NULL, options_sub, __$null, prefix, ttl;
  	zval *this_ptr = getThis();
  
  	ZVAL_UNDEF(&options_sub);
  	ZVAL_NULL(&__$null);
  	ZVAL_UNDEF(&prefix);
  	ZVAL_UNDEF(&ttl);
  
  	zephir_fetch_params(0, 0, 1, &options);
  
  	if (!options) {
  		options = &options_sub;
  		options = &__$null;
  	}
  
  
  	if (Z_TYPE_P(options) == IS_ARRAY) {
  		if (zephir_array_isset_string_fetch(&prefix, options, SL("prefix"), 1)) {
  			zephir_update_property_zval(this_ptr, SL("_prefix"), &prefix);
  		}
  		if (zephir_array_isset_string_fetch(&ttl, options, SL("lifetime"), 1)) {
  			zephir_update_property_zval(this_ptr, SL("_ttl"), &ttl);
  		}
  	}
  
  }
  
  /**
   * Reads meta-data from APCu
   */
  PHP_METHOD(Phalcon_Mvc_Model_MetaData_Apcu, read) {
  
  	zend_long ZEPHIR_LAST_CALL_STATUS;
  	zval *key_param = NULL, data, _0, _1;
  	zval key;
  	zval *this_ptr = getThis();
  
  	ZVAL_UNDEF(&key);
  	ZVAL_UNDEF(&data);
  	ZVAL_UNDEF(&_0);
  	ZVAL_UNDEF(&_1);
  
  	ZEPHIR_MM_GROW();
  	zephir_fetch_params(1, 1, 0, &key_param);
  
  	if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) {
  		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string") TSRMLS_CC);
  		RETURN_MM_NULL();
  	}
  	if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) {
  		zephir_get_strval(&key, key_param);
  	} else {
  		ZEPHIR_INIT_VAR(&key);
  		ZVAL_EMPTY_STRING(&key);
  	}
  
  
  	zephir_read_property(&_0, this_ptr, SL("_prefix"), PH_NOISY_CC | PH_READONLY);
  	ZEPHIR_INIT_VAR(&_1);
  	ZEPHIR_CONCAT_SVV(&_1, "$PMM$", &_0, &key);
  	ZEPHIR_CALL_FUNCTION(&data, "apcu_fetch", NULL, 76, &_1);
  	zephir_check_call_status();
  	if (Z_TYPE_P(&data) == IS_ARRAY) {
  		RETURN_CCTOR(&data);
  	}
  	RETURN_MM_NULL();
  
  }
  
  /**
   * Writes the meta-data to APCu
   */
  PHP_METHOD(Phalcon_Mvc_Model_MetaData_Apcu, write) {
  
  	zend_long ZEPHIR_LAST_CALL_STATUS;
  	zval data;
  	zval *key_param = NULL, *data_param = NULL, _0, _1, _2;
  	zval key;
  	zval *this_ptr = getThis();
  
  	ZVAL_UNDEF(&key);
  	ZVAL_UNDEF(&_0);
  	ZVAL_UNDEF(&_1);
  	ZVAL_UNDEF(&_2);
  	ZVAL_UNDEF(&data);
  
  	ZEPHIR_MM_GROW();
  	zephir_fetch_params(1, 2, 0, &key_param, &data_param);
  
  	if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) {
  		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string") TSRMLS_CC);
  		RETURN_MM_NULL();
  	}
  	if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) {
  		zephir_get_strval(&key, key_param);
  	} else {
  		ZEPHIR_INIT_VAR(&key);
  		ZVAL_EMPTY_STRING(&key);
  	}
  	zephir_get_arrval(&data, data_param);
  
  
  	zephir_read_property(&_0, this_ptr, SL("_prefix"), PH_NOISY_CC | PH_READONLY);
  	ZEPHIR_INIT_VAR(&_1);
  	ZEPHIR_CONCAT_SVV(&_1, "$PMM$", &_0, &key);
  	zephir_read_property(&_2, this_ptr, SL("_ttl"), PH_NOISY_CC | PH_READONLY);
  	ZEPHIR_CALL_FUNCTION(NULL, "apcu_store", NULL, 77, &_1, &data, &_2);
  	zephir_check_call_status();
  	ZEPHIR_MM_RESTORE();
  
  }
  
  zend_object *zephir_init_properties_Phalcon_Mvc_Model_MetaData_Apcu(zend_class_entry *class_type TSRMLS_DC) {
  
  		zval _0, _1$$3;
  		ZVAL_UNDEF(&_0);
  	ZVAL_UNDEF(&_1$$3);
  
  		ZEPHIR_MM_GROW();
  	
  	{
  		zval local_this_ptr, *this_ptr = &local_this_ptr;
  		ZEPHIR_CREATE_OBJECT(this_ptr, class_type);
  		zephir_read_property(&_0, this_ptr, SL("_metaData"), PH_NOISY_CC | PH_READONLY);
  		if (Z_TYPE_P(&_0) == IS_NULL) {
  			ZEPHIR_INIT_VAR(&_1$$3);
  			array_init(&_1$$3);
  			zephir_update_property_zval(this_ptr, SL("_metaData"), &_1$$3);
  		}
  		ZEPHIR_MM_RESTORE();
  		return Z_OBJ_P(this_ptr);
  	}
  
  }
  
  