<?php
	FNTH_import( "memcached" );
	class CacheModel {

		public static function getCacheNameOnParams( $paramname , $params = array() ) {
			return $paramname . "_" . md5(serialize($params));
		}

		public static function cacheValueOnString( $paramname , $value , $expire = 0 ) {
			FNTH_memcached_set( $paramname , $value , $expire );
		}

		public static function cacheValueOnParams( $paramname , $params = array() , $value , $expire = 0 ) {
			FNTH_memcached_set( CacheModel::getCacheNameOnParams( $paramname , $params ) , $value , $expire );
		}

		public static function getCacheValueOnString( $paramname ) {
			return FNTH_memcached_get( $paramname );
		}

		public static function getCacheValueOnParams( $paramname , $params = array() ) {
			return FNTH_memcached_get( CacheModel::getCacheNameOnParams( $paramname , $params ) );
		}
	}

?>
