• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP igbinary_serialize函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中igbinary_serialize函数的典型用法代码示例。如果您正苦于以下问题:PHP igbinary_serialize函数的具体用法?PHP igbinary_serialize怎么用?PHP igbinary_serialize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了igbinary_serialize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: test_space

function test_space($testname, $data)
{
    $phplen = strlen(serialize($data));
    $igbinarylen = strlen(igbinary_serialize($data));
    printf("  php     : %5u\n", $phplen);
    printf("  igbinary: %5u (%.02f%%)\n", $igbinarylen, $igbinarylen * 100 / $phplen);
}
开发者ID:somia,项目名称:igbinary,代码行数:7,代码来源:tests.php


示例2: phpSerialize

 /**
  * @param mixed $data Data to serialize
  * @param bool $useIgBinary Use igBinary extension if supported
  *
  * @return string
  */
 protected function phpSerialize($data, $useIgBinary = true)
 {
     if ($this->isIgBinarySupported() && $useIgBinary) {
         return igbinary_serialize($data);
     }
     return serialize($data);
 }
开发者ID:aurimasniekis,项目名称:epwt-traits,代码行数:13,代码来源:SerializerTrait.php


示例3: freeze

 /**
  * Freezes this cache backend.
  *
  * All data in a frozen backend remains unchanged and methods which try to add
  * or modify data result in an exception thrown. Possible expiry times of
  * individual cache entries are ignored.
  *
  * On the positive side, a frozen cache backend is much faster on read access.
  * A frozen backend can only be thawed by calling the flush() method.
  *
  * @return void
  * @throws \RuntimeException
  */
 public function freeze()
 {
     if ($this->frozen === true) {
         throw new \RuntimeException(sprintf('The cache "%s" is already frozen.', $this->cacheIdentifier), 1323353176);
     }
     $cacheEntryFileExtensionLength = strlen($this->cacheEntryFileExtension);
     for ($directoryIterator = new \DirectoryIterator($this->cacheDirectory); $directoryIterator->valid(); $directoryIterator->next()) {
         if ($directoryIterator->isDot()) {
             continue;
         }
         if ($cacheEntryFileExtensionLength > 0) {
             $entryIdentifier = substr($directoryIterator->getFilename(), 0, -$cacheEntryFileExtensionLength);
         } else {
             $entryIdentifier = $directoryIterator->getFilename();
         }
         $this->cacheEntryIdentifiers[$entryIdentifier] = true;
         $cacheEntryPathAndFilename = $this->cacheDirectory . $entryIdentifier . $this->cacheEntryFileExtension;
         $lock = new Lock($cacheEntryPathAndFilename);
         file_put_contents($cacheEntryPathAndFilename, $this->internalGet($entryIdentifier, false));
         $lock->release();
     }
     $cachePathAndFileName = $this->cacheDirectory . 'FrozenCache.data';
     $lock = new Lock($cachePathAndFileName);
     if ($this->useIgBinary === true) {
         file_put_contents($cachePathAndFileName, igbinary_serialize($this->cacheEntryIdentifiers));
     } else {
         file_put_contents($cachePathAndFileName, serialize($this->cacheEntryIdentifiers));
     }
     $lock->release();
     $this->frozen = true;
 }
开发者ID:mkeitsch,项目名称:flow-development-collection,代码行数:44,代码来源:FileBackend.php


示例4: serialize

	protected function serialize ($value) {
		if ($this->igbinary) {
			return igbinary_serialize($value);
		}

		return serialize($value);
	}
开发者ID:4otaku,项目名称:framework,代码行数:7,代码来源:Files.php


示例5: serialize

 public function serialize($data)
 {
     if ($this->igbinary) {
         return igbinary_serialize($data);
     }
     return serialize($data);
 }
开发者ID:rolandinsh,项目名称:apDeliveryCacheRedis,代码行数:7,代码来源:Redis.php


示例6: bench

function bench($value, $n = 1000000)
{
    $benchmark = new Benchmark();
    $benchmark->add('serialize', function () use(&$value) {
        serialize($value);
    });
    $benchmark->add('json_encode', function () use(&$value) {
        json_encode($value);
    });
    if (function_exists('bin_encode')) {
        $benchmark->add('bin_encode', function () use(&$value) {
            bin_encode($value);
        });
    }
    if (function_exists('bson_encode')) {
        $benchmark->add('bson_encode', function () use(&$value) {
            bson_encode($value);
        });
    }
    if (function_exists('msgpack_pack')) {
        $benchmark->add('msgpack_pack', function () use(&$value) {
            msgpack_pack($value);
        });
    }
    if (function_exists('igbinary_serialize')) {
        $benchmark->add('igbinary_serialize', function () use(&$value) {
            igbinary_serialize($value);
        });
    }
    $benchmark->add('var_export', function () use(&$value) {
        var_export($value, true);
    });
    $benchmark->setCount($n);
    $benchmark->run();
}
开发者ID:ovr,项目名称:php-web-benchmarks,代码行数:35,代码来源:serialize.php


示例7: freeze

 /**
  * Freezes this cache backend.
  *
  * All data in a frozen backend remains unchanged and methods which try to add
  * or modify data result in an exception thrown. Possible expiry times of
  * individual cache entries are ignored.
  *
  * On the positive side, a frozen cache backend is much faster on read access.
  * A frozen backend can only be thawed by calling the flush() method.
  *
  * @return void
  * @throws \RuntimeException
  */
 public function freeze()
 {
     if ($this->frozen === TRUE) {
         throw new \RuntimeException(sprintf('The cache "%s" is already frozen.', $this->cacheIdentifier), 1323353176);
     }
     $cacheEntryFileExtensionLength = strlen($this->cacheEntryFileExtension);
     for ($directoryIterator = new \DirectoryIterator($this->cacheDirectory); $directoryIterator->valid(); $directoryIterator->next()) {
         if ($directoryIterator->isDot()) {
             continue;
         }
         if ($cacheEntryFileExtensionLength > 0) {
             $entryIdentifier = substr($directoryIterator->getFilename(), 0, -$cacheEntryFileExtensionLength);
         } else {
             $entryIdentifier = $directoryIterator->getFilename();
         }
         $this->cacheEntryIdentifiers[$entryIdentifier] = TRUE;
         file_put_contents($this->cacheDirectory . $entryIdentifier . $this->cacheEntryFileExtension, $this->get($entryIdentifier));
     }
     if ($this->useIgBinary === TRUE) {
         file_put_contents($this->cacheDirectory . 'FrozenCache.data', igbinary_serialize($this->cacheEntryIdentifiers));
     } else {
         file_put_contents($this->cacheDirectory . 'FrozenCache.data', serialize($this->cacheEntryIdentifiers));
     }
     $this->frozen = TRUE;
 }
开发者ID:adrolli,项目名称:TYPO3.CMS,代码行数:38,代码来源:FileBackend.php


示例8: set

 /**
  * Store data on the cache server.
  *
  * @param string       $key        Key we can use to retrieve the data.
  * @param string|array $data       Data to store on the cache server.
  * @param int          $expiration Time before the data expires on the cache server.
  *
  * @return bool Success/Failure.
  * @access public
  */
 public function set($key, $data, $expiration)
 {
     if ($this->connected === true && $this->ping() === true) {
         return $this->server->set($key, $this->isRedis ? $this->IgBinarySupport ? igbinary_serialize($data) : serialize($data) : $data, $expiration);
     }
     return false;
 }
开发者ID:sebst3r,项目名称:nZEDb,代码行数:17,代码来源:Cache.php


示例9: testSerialize

 /**
  * @dataProvider getTestData
  */
 public function testSerialize($value, $serialized, $expected = null)
 {
     if (!extension_loaded('igbinary')) {
         $this->markTestSkipped('The igbinary extension must be loaded');
     }
     $serialized = igbinary_serialize($value);
     parent::testSerialize($value, $serialized, $expected);
 }
开发者ID:savritsky,项目名称:cache,代码行数:11,代码来源:IgbinarySerializerTest.php


示例10: _tempData_serialize

 private function _tempData_serialize($data)
 {
     if (true === $this->_has_igbinary_status) {
         return igbinary_serialize($data);
     } else {
         return serialize($data);
     }
 }
开发者ID:Bushzhao,项目名称:rvbwebsite,代码行数:8,代码来源:TempData.php


示例11: serialize

 private static function serialize($o)
 {
     $igbinary = extension_loaded('igbinary');
     if ($igbinary) {
         return @igbinary_serialize($o);
     }
     return @serialize($o);
 }
开发者ID:splitice,项目名称:radical-web-event,代码行数:8,代码来源:RedisStorage.php


示例12: serialize

/**
 * @param mixed $val
 * @return string
 */
function serialize($val)
{
    if (function_exists('igbinary_serialize')) {
        return \igbinary_serialize($val);
    } else {
        return \serialize($val);
    }
}
开发者ID:helpfulrobot,项目名称:heystack-heystack,代码行数:12,代码来源:functions.php


示例13: _serialize

 private function _serialize($data)
 {
     if ($this->_has_igbinary) {
         return igbinary_serialize($data);
     } else {
         return serialize($data);
     }
 }
开发者ID:Bushzhao,项目名称:rvbwebsite,代码行数:8,代码来源:PepVN_CacheSimpleFile.php


示例14: unpack

 /**
  */
 public function unpack($data)
 {
     $out = igbinary_unserialize($data);
     if (!is_null($out) || $data == igbinary_serialize(null)) {
         return $out;
     }
     throw new Horde_Pack_Exception('Error when unpacking serialized data.');
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:10,代码来源:Igbinary.php


示例15: sendPacket

 /**
  * @TODO DESCR
  * @param $p
  */
 public function sendPacket($p)
 {
     if ($p === null) {
         return;
     }
     $data = \igbinary_serialize($p);
     $this->write(pack('N', mb_orig_strlen($data)) . $data);
 }
开发者ID:kakserpom,项目名称:phpdaemon,代码行数:12,代码来源:WorkerConnection.php


示例16: encrypt

 /**
  * 加密
  * @param $data 支持数据和字符串;
  * @return string 返回加密后的字符串
  */
 public function encrypt($data)
 {
     if (empty($data)) {
         return '';
     }
     $data = igbinary_serialize($data);
     $data = Yii::$app->getSecurity()->encryptByKey($data, self::$_key);
     return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
 }
开发者ID:hhy5861,项目名称:yii2-ticket,代码行数:14,代码来源:Encrypt.php


示例17: serialize

 /**
  * serialize
  *
  * @param mixed $value
  *
  * @return string
  */
 public function serialize($value)
 {
     if (function_exists('igbinary_serialize')) {
         return igbinary_serialize($value);
     } else {
         // fallback
         return serialize($value);
     }
 }
开发者ID:hhgr,项目名称:hhgolf,代码行数:16,代码来源:SerializerIgbinary.php


示例18: pack

 public static function pack($data)
 {
     if (function_exists("igbinary_serialize")) {
         $data = igbinary_serialize($data);
     } else {
         $data = serialize($data);
     }
     return self::PACKED_MARK . rtrim(base64_encode($data), "=");
 }
开发者ID:4otaku,项目名称:4otaku,代码行数:9,代码来源:abstract.php


示例19: _storeData

 /**
  * Store cell data in cache for the current cell object if it's "dirty",
  *     and the 'nullify' the current cell object
  *
  * @return	void
  * @throws	PHPExcel_Exception
  */
 protected function _storeData()
 {
     if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
         $this->_currentObject->detach();
         $this->_cellCache[$this->_currentObjectID] = igbinary_serialize($this->_currentObject);
         $this->_currentCellIsDirty = false;
     }
     $this->_currentObjectID = $this->_currentObject = null;
 }
开发者ID:ljhchshm,项目名称:weixin,代码行数:16,代码来源:Igbinary.php


示例20: serialize

 /**
  * Serialize PHP value to igbinary
  *
  * @param  mixed $value
  * @param  array $opts
  * @return string
  * @throws Zend_Serializer_Exception on igbinary error
  */
 public function serialize($value, array $opts = array())
 {
     $ret = igbinary_serialize($value);
     if ($ret === false) {
         $lastErr = error_get_last();
         throw new Zend_Serializer_Exception($lastErr['message']);
     }
     return $ret;
 }
开发者ID:trigoesrodrigo,项目名称:icingaweb2,代码行数:17,代码来源:Igbinary.php



注:本文中的igbinary_serialize函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP igbinary_unserialize函数代码示例发布时间:2022-05-15
下一篇:
PHP ifx_textasvarchar函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap