add dbuf_reset in class dbuf_pool for performance improvement

This commit is contained in:
ubuntu14 2015-06-22 05:41:56 -07:00
parent 26ede3c85a
commit 1156716a32
5 changed files with 18 additions and 3 deletions

View File

@ -1,6 +1,12 @@
修改历史列表:
------------------------------------------------------------------------
317) 2015.6.22
317.1) feature: dbuf_pool 类增加了 dbuf_reset 方法,可以重复使用该类对象
317.2) performance: redis_command 类当每一个命令处理完毕后不再释放内存池对象,
而是复用之
317.3) bugfix: redis_zset 类有一处在调用 sizeof 时未 -1
316) 2015.6.17
316.1) feature: 增加了类 thread_queue 用来处理线程消息队列

View File

@ -17,6 +17,11 @@ public:
dbuf_pool(size_t block_size = 8192);
~dbuf_pool();
/**
* 便使
*/
void dbuf_reset();
/**
*
* @param len {size_t} (

View File

@ -113,8 +113,7 @@ void redis_command::clear(bool save_slot /* = false */)
{
if (used_ > 0)
{
delete pool_;
pool_ = NEW dbuf_pool();
pool_->dbuf_reset();
result_ = NULL;
}
if (!save_slot)

View File

@ -1010,7 +1010,7 @@ int redis_zset::zrangebylex(const char* key, const char* min, const char* max,
size_t argc = 4;
argv[0] = "ZRANGEBYLEX";
lens[0] = sizeof("ZRANGEBYLEX");
lens[0] = sizeof("ZRANGEBYLEX") - 1;
argv[1] = key;
lens[1] = strlen(key);

View File

@ -14,6 +14,11 @@ dbuf_pool::~dbuf_pool()
acl_dbuf_pool_destroy(pool_);
}
void dbuf_pool::dbuf_reset()
{
acl_dbuf_pool_reset(pool_);
}
void* dbuf_pool::dbuf_alloc(size_t len)
{
return acl_dbuf_pool_alloc(pool_, len);