Class **Phalcon\\Mvc\\Model\\MetaData\\Redis** ============================================== *extends* abstract class :doc:`Phalcon\\Mvc\\Model\\MetaData ` *implements* :doc:`Phalcon\\Mvc\\Model\\MetaDataInterface `, :doc:`Phalcon\\Di\\InjectionAwareInterface ` .. role:: raw-html(raw) :format: html :raw-html:`Source on GitHub` Stores model meta-data in the Redis. By default meta-data is stored for 48 hours (172800 seconds) .. code-block:: php "127.0.0.1", "port" => 6379, "persistent" => 0, "statsKey" => "_PHCM_MM", "lifetime" => 172800, "index" => 2, ] ); Constants --------- *integer* **MODELS_ATTRIBUTES** *integer* **MODELS_PRIMARY_KEY** *integer* **MODELS_NON_PRIMARY_KEY** *integer* **MODELS_NOT_NULL** *integer* **MODELS_DATA_TYPES** *integer* **MODELS_DATA_TYPES_NUMERIC** *integer* **MODELS_DATE_AT** *integer* **MODELS_DATE_IN** *integer* **MODELS_IDENTITY_COLUMN** *integer* **MODELS_DATA_TYPES_BIND** *integer* **MODELS_AUTOMATIC_DEFAULT_INSERT** *integer* **MODELS_AUTOMATIC_DEFAULT_UPDATE** *integer* **MODELS_DEFAULT_VALUES** *integer* **MODELS_EMPTY_STRING_VALUES** *integer* **MODELS_COLUMN_MAP** *integer* **MODELS_REVERSE_COLUMN_MAP** Methods ------- public **__construct** ([*array* $options]) Phalcon\\Mvc\\Model\\MetaData\\Redis constructor public **read** (*mixed* $key) Reads metadata from Redis public **write** (*mixed* $key, *mixed* $data) Writes the metadata to Redis public **reset** () Flush Redis data and resets internal meta-data in order to regenerate it final protected **_initialize** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model, *mixed* $key, *mixed* $table, *mixed* $schema) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Initialize the metadata for certain table public **setDI** (:doc:`Phalcon\\DiInterface ` $dependencyInjector) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Sets the DependencyInjector container public **getDI** () inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Returns the DependencyInjector container public **setStrategy** (:doc:`Phalcon\\Mvc\\Model\\MetaData\\StrategyInterface ` $strategy) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Set the meta-data extraction strategy public **getStrategy** () inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Return the strategy to obtain the meta-data final public **readMetaData** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Reads the complete meta-data for certain model .. code-block:: php readMetaData( new Robots() ) ); final public **readMetaDataIndex** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model, *mixed* $index) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Reads meta-data for certain model .. code-block:: php readMetaDataIndex( new Robots(), 0 ) ); final public **writeMetaDataIndex** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model, *mixed* $index, *mixed* $data) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Writes meta-data for certain model using a MODEL_* constant .. code-block:: php writeColumnMapIndex( new Robots(), MetaData::MODELS_REVERSE_COLUMN_MAP, [ "leName" => "name", ] ) ); final public **readColumnMap** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Reads the ordered/reversed column map for certain model .. code-block:: php readColumnMap( new Robots() ) ); final public **readColumnMapIndex** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model, *mixed* $index) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Reads column-map information for certain model using a MODEL_* constant .. code-block:: php readColumnMapIndex( new Robots(), MetaData::MODELS_REVERSE_COLUMN_MAP ) ); public **getAttributes** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Returns table attributes names (fields) .. code-block:: php getAttributes( new Robots() ) ); public **getPrimaryKeyAttributes** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Returns an array of fields which are part of the primary key .. code-block:: php getPrimaryKeyAttributes( new Robots() ) ); public **getNonPrimaryKeyAttributes** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Returns an array of fields which are not part of the primary key .. code-block:: php getNonPrimaryKeyAttributes( new Robots() ) ); public **getNotNullAttributes** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Returns an array of not null attributes .. code-block:: php getNotNullAttributes( new Robots() ) ); public **getDataTypes** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Returns attributes and their data types .. code-block:: php getDataTypes( new Robots() ) ); public **getDataTypesNumeric** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Returns attributes which types are numerical .. code-block:: php getDataTypesNumeric( new Robots() ) ); public *string* **getIdentityField** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Returns the name of identity field (if one is present) .. code-block:: php getIdentityField( new Robots() ) ); public **getBindTypes** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Returns attributes and their bind data types .. code-block:: php getBindTypes( new Robots() ) ); public **getAutomaticCreateAttributes** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Returns attributes that must be ignored from the INSERT SQL generation .. code-block:: php getAutomaticCreateAttributes( new Robots() ) ); public **getAutomaticUpdateAttributes** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Returns attributes that must be ignored from the UPDATE SQL generation .. code-block:: php getAutomaticUpdateAttributes( new Robots() ) ); public **setAutomaticCreateAttributes** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model, *array* $attributes) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Set the attributes that must be ignored from the INSERT SQL generation .. code-block:: php setAutomaticCreateAttributes( new Robots(), [ "created_at" => true, ] ); public **setAutomaticUpdateAttributes** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model, *array* $attributes) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Set the attributes that must be ignored from the UPDATE SQL generation .. code-block:: php setAutomaticUpdateAttributes( new Robots(), [ "modified_at" => true, ] ); public **setEmptyStringAttributes** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model, *array* $attributes) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Set the attributes that allow empty string values .. code-block:: php setEmptyStringAttributes( new Robots(), [ "name" => true, ] ); public **getEmptyStringAttributes** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Returns attributes allow empty strings .. code-block:: php getEmptyStringAttributes( new Robots() ) ); public **getDefaultValues** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Returns attributes (which have default values) and their default values .. code-block:: php getDefaultValues( new Robots() ) ); public **getColumnMap** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Returns the column map if any .. code-block:: php getColumnMap( new Robots() ) ); public **getReverseColumnMap** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Returns the reverse column map if any .. code-block:: php getReverseColumnMap( new Robots() ) ); public **hasAttribute** (:doc:`Phalcon\\Mvc\\ModelInterface ` $model, *mixed* $attribute) inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Check if a model has certain attribute .. code-block:: php hasAttribute( new Robots(), "name" ) ); public **isEmpty** () inherited from :doc:`Phalcon\\Mvc\\Model\\MetaData ` Checks if the internal meta-data container is empty .. code-block:: php isEmpty() );