ZSET(stored set)

和 set 一样是字符串的集合,不同的是每个元素都会关联一个 double 类型的 score 。实现使用的是 skip list 和 hash table , skip list 的实现使用的是双线链表。 Score 的主要作用是排序,因此 sorted set 主要用作索引。

zAdd

Description

Adds the specified member with a given score to the sorted set stored at key.

增加一个或多个元素,如果该元素已经存在,更新它的socre值
虽然有序集合有序,但它也是集合,不能重复元素,添加重复元素只会
更新原有元素的score值

Parameters

key
score : double
value: string

Return value

Long 1 if the element is added. 0 otherwise.

Example

$redis->zAdd('key', 1, 'val1');
$redis->zAdd('key', 0, 'val0');
$redis->zAdd('key', 5, 'val5');
$redis->zRange('key', 0, -1); // array(val0, val1, val5)

  

zRange

Description

Returns a range of elements from the ordered set stored at the specified key, with values in the range [start, end]. start and stop are interpreted as zero-based indices: 0 the first element, 1 the second ... -1 the last element, -2 the penultimate ...

取得特定范围内的排序元素,0代表第一个元素,1代表第二个以此类推。-1代表最后一个,-2代表倒数第二个...

Parameters

key
start: long
end: long
withscores: bool = false

Return value

Array containing the values in specified range.

Example

$redis->zAdd('key1', 0, 'val0');
$redis->zAdd('key1', 2, 'val2');
$redis->zAdd('key1', 10, 'val10');
$redis->zRange('key1', 0, -1); /* array('val0', 'val2', 'val10') */ // with scores
$redis->zRange('key1', 0, -1, true); /* array('val0' => 0, 'val2' => 2, 'val10' => 10) */

  

zDelete, zRem

Description

Deletes a specified member from the ordered set.

从有序集合中删除指定的成员。

Parameters

key
member

Return value

LONG 1 on success, 0 on failure.

Example

$redis->zAdd('key', 0, 'val0');
$redis->zAdd('key', 2, 'val2');
$redis->zAdd('key', 10, 'val10');
$redis->zDelete('key', 'val2');
$redis->zRange('key', 0, -1); /* array('val0', 'val10') */

  

zRevRange

Description

Returns the elements of the sorted set stored at the specified key in the range [start, end] in reverse order. start and stop are interpretated as zero-based indices: 0 the first element, 1 the second ... -1 the last element, -2 the penultimate ...

返回key对应的有序集合中指定区间的所有元素。这些元素按照score从高到低的顺序进行排列。对于具有相同的score的元素而言,将会按照递减的字典顺序进行排列。该命令与ZRANGE类似,只是该命令中元素的排列顺序与前者不同。

Parameters

key
start: long
end: long
withscores: bool = false

Return value

Array containing the values in specified range.

Example

$redis->zAdd('key', 0, 'val0');
$redis->zAdd('key', 2, 'val2');
$redis->zAdd('key', 10, 'val10');
$redis->zRevRange('key', 0, -1); /* array('val10', 'val2', 'val0') */ // with scores
$redis->zRevRange('key', 0, -1, true); /* array('val10' => 10, 'val2' => 2, 'val0' => 0) */

  

zRangeByScore, zRevRangeByScore

Description

Returns the elements of the sorted set stored at the specified key which have scores in the range [start,end]. Adding a parenthesis before start or end excludes it from the range. +inf and -inf are also valid limits. zRevRangeByScore returns the same items in reverse order, when the start and end parameters are swapped.

返回key对应的有序集合中score介于min和max之间的所有元素(包哈score等于min或者max的元素)。元素按照score从低到高的顺序排列。如果元素具有相同的score,那么会按照字典顺序排列。
可选的选项LIMIT可以用来获取一定范围内的匹配元素。如果偏移值较大,有序集合需要在获得将要返回的元素之前进行遍历,因此会增加O(N)的时间复杂度。可选的选项WITHSCORES可以使得在返回元素的同时返回元素的score,该选项自从Redis 2.0版本后可用。

Parameters

key
start: string
end: string
options: array

Two options are available: withscores => TRUE, and limit => array($offset, $count)

Return value

Array containing the values in specified range.

Example

$redis->zAdd('key', 0, 'val0');
$redis->zAdd('key', 2, 'val2');
$redis->zAdd('key', 10, 'val10');
$redis->zRangeByScore('key', 0, 3); /* array('val0', 'val2') */
$redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE); /* array('val0' => 0, 'val2' => 2) */
$redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1)); /* array('val2' => 2) */
$redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1)); /* array('val2') */
$redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE, 'limit' => array(1, 1)); /* array('val2' => 2) */

  

zCount

Description

Returns the number of elements of the sorted set stored at the specified key which have scores in the range [start,end]. Adding a parenthesis before start or end excludes it from the range. +inf and -inf are also valid limits.

返回key对应的有序集合中介于min和max间的元素的个数。

Parameters

key
start: string
end: string

Return value

LONG the size of a corresponding zRangeByScore.

Example

$redis->zAdd('key', 0, 'val0');
$redis->zAdd('key', 2, 'val2');
$redis->zAdd('key', 10, 'val10');
$redis->zCount('key', 0, 3); /* 2, corresponding to array('val0', 'val2') */

  

zRemRangeByScore, zDeleteRangeByScore

Description

Deletes the elements of the sorted set stored at the specified key which have scores in the range [start,end].

移除key对应的有序集合中scroe位于min和max(包含端点)之间的所哟元素。从2.1.6版本后开始,区间端点min和max可以被排除在外,这和ZRANGEBYSCORE的语法一样。

Parameters

key
start: double or "+inf" or "-inf" string
end: double or "+inf" or "-inf" string

Return value

LONG The number of values deleted from the sorted set

Example

$redis->zAdd('key', 0, 'val0');
$redis->zAdd('key', 2, 'val2');
$redis->zAdd('key', 10, 'val10');
$redis->zRemRangeByScore('key', 0, 3); /* 2 */

  

zRemRangeByRank, zDeleteRangeByRank

Description

Deletes the elements of the sorted set stored at the specified key which have rank in the range [start,end].

移除key对应的有序集合中rank值介于start和stop之间的所有元素。start和stop均是从0开始的,并且两者均可以是负值。当索引值为负值时,表明偏移值从有序集合中score值最高的元素开始。例如:-1表示具有最高score的元素,而-2表示具有次高score的元素,以此类推。

Parameters

key
start: LONG
end: LONG

Return value

LONG The number of values deleted from the sorted set

Example

$redis->zAdd('key', 1, 'one');
$redis->zAdd('key', 2, 'two');
$redis->zAdd('key', 3, 'three');
$redis->zRemRangeByRank('key', 0, 1); /* 2 */
$redis->zRange('key', 0, -1, array('withscores' => TRUE)); /* array('three' => 3) */

  

zSize, zCard

Description

Returns the cardinality of an ordered set.

返回存储在key对应的有序集合中的元素的个数。

Parameters

key

Return value

Long, the set's cardinality

Example

$redis->zAdd('key', 0, 'val0');
$redis->zAdd('key', 2, 'val2');
$redis->zAdd('key', 10, 'val10');
$redis->zSize('key'); /* 3 */

  

zScore

Description

Returns the score of a given member in the specified sorted set.

返回key对应的有序集合中member的score值。如果member在有序集合中不存在,那么将会返回nil。

Parameters

key
member

Return value

Double

Example

$redis->zAdd('key', 2.5, 'val2');
$redis->zScore('key', 'val2'); /* 2.5 */

  

zRank, zRevRank

Description

Returns the rank of a given member in the specified sorted set, starting at 0 for the item with the smallest score. zRevRank starts at 0 for the item with the largest score.

返回key对应的有序集合中member元素的索引值,元素按照score从低到高进行排列。rank值(或index)是从0开始的,这意味着具有最低score值的元素的rank值为0。使用ZREVRANK可以获得从高到低排列的元素的rank(或index)。

Parameters

key
member

Return value

Long, the item's score.

Example

$redis->delete('z');
$redis->zAdd('key', 1, 'one');
$redis->zAdd('key', 2, 'two');
$redis->zRank('key', 'one'); /* 0 */
$redis->zRank('key', 'two'); /* 1 */
$redis->zRevRank('key', 'one'); /* 1 */
$redis->zRevRank('key', 'two'); /* 0 */

  

zIncrBy

Description

Increments the score of a member from a sorted set by a given amount.

将key对应的有序集合中member元素的scroe加上increment。如果指定的member不存在,那么将会添加该元素,并且其score的初始值为increment。如果key不存在,那么将会创建一个新的有序列表,其中包含member这一唯一的元素。如果key对应的值不是有序列表,那么将会发生错误。指定的score的值应该是能够转换为数字值的字符串,并且接收双精度浮点数。同时,你也可用提供一个负值,这样将减少score的值。

Parameters

key
value: (double) value that will be added to the member's score
member

Return value

DOUBLE the new value

Examples

$redis->delete('key');
$redis->zIncrBy('key', 2.5, 'member1'); /* key or member1 didn't exist, so member1's score is to 0 before the increment */
/* and now has the value 2.5 */
$redis->zIncrBy('key', 1, 'member1'); /* 3.5 */

  

zUnion

Description

Creates an union of sorted sets given in second argument. The result of the union will be stored in the sorted set defined by the first argument. The third optionnel argument defines weights to apply to the sorted sets in input. In this case, the weights will be multiplied by the score of each element in the sorted set before applying the aggregation. The forth argument defines the AGGREGATEoption which specify how the results of the union are aggregated.

对keys对应的numkeys个有序集合计算合集,并将结果存储在destination中。在传递输入keys之前必须提供输入keys的个数和其它可选参数。在默认情况下,元素的结果score是包含该元素的所有有序集合中score的和。如果使用WEIGHTS选项,你可以对每一个有序集合指定一个操作因子。这意味着每一个有序集合中的每个元素的score在传递给聚合函数之前均会被乘以该因子。当WEIGHTS没有指定时,操作因子默认为1。
使用AGGREGATE选项,你可以指定交集中的结果如何被聚合。该选项默认值为SUM,在这种情况下,一个元素的所有score值均会被相加。当选项被设置为MIN或MAX时,结果集合中将会包含一个元素的最大或者最小的score值。如果destination已经存在,那么它将会被重写。

Parameters

keyOutput
arrayZSetKeys
arrayWeights
aggregateFunction Either "SUM", "MIN", or "MAX": defines the behaviour to use on duplicate entries during the zUnion.

Return value

LONG The number of values in the new sorted set.

Example

$redis->delete('k1');
$redis->delete('k2');
$redis->delete('k3');
$redis->delete('ko1');
$redis->delete('ko2');
$redis->delete('ko3'); $redis->zAdd('k1', 0, 'val0');
$redis->zAdd('k1', 1, 'val1'); $redis->zAdd('k2', 2, 'val2');
$redis->zAdd('k2', 3, 'val3'); $redis->zUnion('ko1', array('k1', 'k2')); /* 4, 'ko1' => array('val0', 'val1', 'val2', 'val3') */ /* Weighted zUnion */
$redis->zUnion('ko2', array('k1', 'k2'), array(1, 1)); /* 4, 'ko1' => array('val0', 'val1', 'val2', 'val3') */
$redis->zUnion('ko3', array('k1', 'k2'), array(5, 1)); /* 4, 'ko1' => array('val0', 'val2', 'val3', 'val1') */

  

zInter

Description

Creates an intersection of sorted sets given in second argument. The result of the union will be stored in the sorted set defined by the first argument. The third optionnel argument defines weights to apply to the sorted sets in input. In this case, the weights will be multiplied by the score of each element in the sorted set before applying the aggregation. The forth argument defines the AGGREGATEoption which specify how the results of the union are aggregated.

计算numkeys个由keys指定的有序集合的交集,并且将结果存储在destination中。在该命令中,在你传递输入keys之前,必须提供输入keys的个数和其它可选的参数。
在默认情况下,一个元素的结果score是具有该元素的所有有序集合的score的和。关于WEIGHTS和AGGREGATE选项,可以参看ZUNIONSTORE命令。如果目标已经存在,那么它将会被重写。

Parameters

keyOutput
arrayZSetKeys
arrayWeights
aggregateFunction Either "SUM", "MIN", or "MAX": defines the behaviour to use on duplicate entries during the zInter.

Return value

LONG The number of values in the new sorted set.

Example

$redis->delete('k1');
$redis->delete('k2');
$redis->delete('k3'); $redis->delete('ko1');
$redis->delete('ko2');
$redis->delete('ko3');
$redis->delete('ko4'); $redis->zAdd('k1', 0, 'val0');
$redis->zAdd('k1', 1, 'val1');
$redis->zAdd('k1', 3, 'val3'); $redis->zAdd('k2', 2, 'val1');
$redis->zAdd('k2', 3, 'val3'); $redis->zInter('ko1', array('k1', 'k2')); /* 2, 'ko1' => array('val1', 'val3') */
$redis->zInter('ko2', array('k1', 'k2'), array(1, 1)); /* 2, 'ko2' => array('val1', 'val3') */ /* Weighted zInter */
$redis->zInter('ko3', array('k1', 'k2'), array(1, 5), 'min'); /* 2, 'ko3' => array('val1', 'val3') */
$redis->zInter('ko4', array('k1', 'k2'), array(1, 5), 'max'); /* 2, 'ko4' => array('val3', 'val1') */

  

hSet

Description

Adds a value to the hash stored at key. If this value is already in the hash, FALSE is returned.

添加一个VALUE到HASH中。如果VALUE已经存在于HASH中,则返回FALSE。

Parameters

key
hashKey
value

Return value

LONG 1 if value didn't exist and was added successfully, 0 if the value was already present and was replaced, FALSE if there was an error.

Example

$redis->delete('h')
$redis->hSet('h', 'key1', 'hello'); /* 1, 'key1' => 'hello' in the hash at "h" */
$redis->hGet('h', 'key1'); /* returns "hello" */ $redis->hSet('h', 'key1', 'plop'); /* 0, value was replaced. */
$redis->hGet('h', 'key1'); /* returns "plop" */

  

hSetNx

Description

Adds a value to the hash stored at key only if this field isn't already in the hash.

添加一个VALUE到HASH STORE中,如果FIELD不存在。

Return value

BOOL TRUE if the field was set, FALSE if it was already present.

Example

$redis->delete('h')
$redis->hSetNx('h', 'key1', 'hello'); /* TRUE, 'key1' => 'hello' in the hash at "h" */
$redis->hSetNx('h', 'key1', 'world'); /* FALSE, 'key1' => 'hello' in the hash at "h". No change since the field wasn't replaced. */

  

hGet

Description

Gets a value from the hash stored at key. If the hash table doesn't exist, or the key doesn't exist, FALSE is returned.

取得HASH中的VALUE,如何HASH不存在,或者KEY不存在返回FLASE。

Parameters

key
hashKey

Return value

STRING The value, if the command executed successfully BOOL FALSE in case of failure

hLen

Description

Returns the length of a hash, in number of items

取得HASH表的长度。

Parameters

key

Return value

LONG the number of items in a hash, FALSE if the key doesn't exist or isn't a hash.

Example

$redis->delete('h')
$redis->hSet('h', 'key1', 'hello');
$redis->hSet('h', 'key2', 'plop');
$redis->hLen('h'); /* returns 2 */

  

hDel

Description

Removes a value from the hash stored at key. If the hash table doesn't exist, or the key doesn't exist, FALSE is returned.

删除指定的元素。

Parameters

key
hashKey

Return value

BOOL TRUE in case of success, FALSE in case of failure

hKeys

Description

Returns the keys in a hash, as an array of strings.

取得HASH表中的KEYS,以数组形式返回。

Parameters

Key: key

Return value

An array of elements, the keys of the hash. This works like PHP's array_keys().

Example

$redis->delete('h');
$redis->hSet('h', 'a', 'x');
$redis->hSet('h', 'b', 'y');
$redis->hSet('h', 'c', 'z');
$redis->hSet('h', 'd', 't');
var_dump($redis->hKeys('h'));

  

Output:

array(4) {
[0]=>
string(1) "a"
[1]=>
string(1) "b"
[2]=>
string(1) "c"
[3]=>
string(1) "d"
}

  

The order is random and corresponds to redis' own internal representation of the set structure.

hVals

Description

Returns the values in a hash, as an array of strings.

取得HASH表中所有的VALUE,以数组形式返回。

Parameters

Key: key

Return value

An array of elements, the values of the hash. This works like PHP's array_values().

Example

$redis->delete('h');
$redis->hSet('h', 'a', 'x');
$redis->hSet('h', 'b', 'y');
$redis->hSet('h', 'c', 'z');
$redis->hSet('h', 'd', 't');
var_dump($redis->hVals('h'));

  

Output:

array(4) {
[0]=>
string(1) "x"
[1]=>
string(1) "y"
[2]=>
string(1) "z"
[3]=>
string(1) "t"
}

  

The order is random and corresponds to redis' own internal representation of the set structure.

hGetAll

Description

Returns the whole hash, as an array of strings indexed by strings.

取得整个HASH表的信息,返回一个以KEY为索引VALUE为内容的数组。

Parameters

Key: key

Return value

An array of elements, the contents of the hash.

Example

$redis->delete('h');
$redis->hSet('h', 'a', 'x');
$redis->hSet('h', 'b', 'y');
$redis->hSet('h', 'c', 'z');
$redis->hSet('h', 'd', 't');
var_dump($redis->hGetAll('h'));

  

Output:

array(4) {
["a"]=>
string(1) "x"
["b"]=>
string(1) "y"
["c"]=>
string(1) "z"
["d"]=>
string(1) "t"
}

  

The order is random and corresponds to redis' own internal representation of the set structure.

hExists

Description

Verify if the specified member exists in a key.

验证HASH表中是否存在指定的KEY-VALUE

Parameters

key
memberKey

Return value

BOOL: If the member exists in the hash table, return TRUE, otherwise return FALSE.

Examples

$redis->hSet('h', 'a', 'x');
$redis->hExists('h', 'a'); /* TRUE */
$redis->hExists('h', 'NonExistingKey'); /* FALSE */

  

hIncrBy

Description

Increments the value of a member from a hash by a given amount.

根据HASH表的KEY,为KEY对应的VALUE自增参数VALUE。

Parameters

key
member
value: (integer) value that will be added to the member's value

Return value

LONG the new value

Examples

$redis->delete('h');
$redis->hIncrBy('h', 'x', 2); /* returns 2: h[x] = 2 now. */
$redis->hIncrBy('h', 'x', 1); /* h[x] ← 2 + 1. Returns 3 */

  

hIncrByFloat

Description

Increments the value of a hash member by the provided float value

根据HASH表的KEY,为KEY对应的VALUE自增参数VALUE。浮点型Parameters

key
member
value: (float) value that will be added to the member's value

Return value

FLOAT the new value

Examples

$redis->delete('h');
$redis->hIncrByFloat('h','x', 1.5); /* returns 1.5: h[x] = 1.5 now */
$redis->hIncrByFLoat('h', 'x', 1.5); /* returns 3.0: h[x] = 3.0 now */
$redis->hIncrByFloat('h', 'x', -3.0); /* returns 0.0: h[x] = 0.0 now */

  

hMset

Description

Fills in a whole hash. Non-string values are converted to string, using the standard (string) cast. NULL values are stored as empty strings.

批量填充HASH表。不是字符串类型的VALUE,自动转换成字符串类型。使用标准的值。NULL值将被储存为一个空的字符串。

Parameters

key
members: key → value array

Return value

BOOL

Examples

$redis->delete('user:1');
$redis->hMset('user:1', array('name' => 'Joe', 'salary' => 2000));
$redis->hIncrBy('user:1', 'salary', 100); // Joe earns 100 more now.

  

hMGet

Description

Retrieve the values associated to the specified fields in the hash.

批量取得HASH表中的VALUE。

Parameters

key
memberKeys Array

Return value

Array An array of elements, the values of the specified fields in the hash, with the hash keys as array keys.

Examples

$redis->delete('h');
$redis->hSet('h', 'field1', 'value1');
$redis->hSet('h', 'field2', 'value2');
$redis->hmGet('h', array('field1', 'field2')); /* returns array('field1' => 'value1', 'field2' => 'value2') */

  

redis:php-redis中有序集合 zset的使用的更多相关文章

  1. redis 学习(7) -- 有序集合

    redis 学习(7) -- 有序集合 zset 结构 有序集合:有序.不能包含重复元素 每个节点包含:score和value两个属性,根据score进行排序 如图: zset 重要 API 含义 命 ...

  2. redis 有序集合(zset)函数

    redis 有序集合(zset)函数 zAdd 命令/方法/函数 Adds the specified member with a given score to the sorted set stor ...

  3. php使用redis的有序集合zset实现延迟队列

    延迟队列就是个带延迟功能的消息队列,相对于普通队列,它可以在指定时间消费掉消息. 延迟队列的应用场景: 1.新用户注册,10分钟后发送邮件或站内信. 2.用户下单后,30分钟未支付,订单自动作废. 我 ...

  4. 聊聊Mysql索引和redis跳表 ---redis的有序集合zset数据结构底层采用了跳表原理 时间复杂度O(logn)(阿里)

    redis使用跳表不用B+数的原因是:redis是内存数据库,而B+树纯粹是为了mysql这种IO数据库准备的.B+树的每个节点的数量都是一个mysql分区页的大小(阿里面试) 还有个几个姊妹篇:介绍 ...

  5. Redis对象——有序集合(ZSet)

    有序集合类型 (Sorted Set或ZSet) 相比于集合类型多了一个排序属性 score(分值),对于有序集合 ZSet 来说,每个存储元素相当于有两个值组成的,一个是有序结合的元素值,一个是排序 ...

  6. 9、Redis五大数据类型---有序集合Zset(sorted set)

    一.简介 zset与set异同 相同之处: 都是没有重复元素的字符串集合 不同之处: 有序集合zset的每个成员都关联了一个评分(score),这个评分(score)被用来按照从最低分到最高分的方式排 ...

  7. Redis入门到高可用(九)——有序集合zset

    一.数据结构 集合与有序集合,列表与有序集合的对比 二.主要API zadd 将一个或多个 member 元素及其 score 值加入到有序集 key 当中. zrem 移除有序集 key 中的一个或 ...

  8. redis有序集合-zset

    概念:它是在set的基础上增加了一个顺序属性,这一属性在添加修改元素的时候可以指定,每次指定后,zset会自动按新的值调整顺序.可以理解为有两列的mysql表,一列存储value,一列存储顺序,操作中 ...

  9. Redis中有序列表(ZSet)相关命令

    redis语序集合和集合set是一样内部value为string类型的集合,有序不允许重复元素 但是,zset的每个元素有一个double类型的分数(score).redis正是靠这个分数对元素从小到 ...

随机推荐

  1. 用户登陆状态,ios开发用户登陆

    IOS开发之记录用户登陆状态,ios开发用户登陆 上一篇博客中提到了用CoreData来进行数据的持久 化,CoreData的配置和使用步骤还是挺复杂的.但熟悉CoreData的使用流程后,CoreD ...

  2. boost:property_tree::ini_parser:::read_ini 读取ini时崩溃

    原因: 1 路径错误 2 配置文件中某一行缺少=,例如用// 做注释的,前面应该加";" 解决办法: 添加异常处理,实例代码如下: #include <boost/prope ...

  3. Design Pattern - 访问者模式

    访问者模式 访问者模式(Visitor), 表示一个作用于某对象结构中的各元素的操作.它使你可以在不改变各元素的类的前提下定义作用于这些元素的新操作. 这个模式相对比较复杂, 而又很少能被用上, 拿G ...

  4. 中间件MQ选型要点

    转载自:  https://www.cnblogs.com/doit8791/p/10227474.html 参考: http://www.52im.net/thread-1647-1-1.html ...

  5. python基础之类的封装

    从封装本身的意思去理解,封装就好像是拿来一个麻袋,把小猫,小狗,小王八,还有alex一起装进麻袋,然后把麻袋封上口子.但其实这种理解相当片面 一 封装什么 你钱包的有多少钱(数据的封装) 你的性取向( ...

  6. chrome命令

    chrome://settings(设置) chrome://extensions(扩展程序) chrome://history(历史记录) chrome://settings/clearBrowse ...

  7. 对比MySQL,你究竟在什么时候更需要MongoDB(转)

    译文:对比MySQL,你究竟在什么时候更需要MongoDB 原文链接: When Should I Use MongoDB rather than MySQL (or other RDBMS): Th ...

  8. 《深入理解Linux网络技术内幕》阅读笔记 --- 路由表

    路由表基本概念 1.路由是由多个不同的数据结构的组合来描述的,每个数据结构代表路由信息的不同部分.例如,一个fib_node对应一个单独的子网,一个fib_alias对应一条路由.这样做的原因是只需通 ...

  9. Linux学习笔记(4)磁盘分区(fdisk)、挂载与文件系统命令

    Linux学习笔记(4)磁盘分区(fdisk).挂载与文件系统命令 1.磁盘分区是怎么表示的? 1.1 对于IDE接口,第一主盘为hda,第1从盘为hdb,第1从盘的第1个分区为hdb1 1.2 对于 ...

  10. beego——原生SQL查询

    使用Raw SQL查询,无需使用ORM表定义. 多数据库,都可直接使用占位符号?,自动转换. 查询时的参数,支持使用Model Struct和Slice,Array ids := []int{1, 2 ...