Constructor
new RedisSession(client, options)
构造函数
- Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
client | 
            
            
            
                
redis.RedisClient
            
             | 
            
            
            
                 redis客户端  | 
        
options | 
            
            
            
                
object
            
             | 
            
            
            
                 选项,可以有以下字段 
  | 
        
Methods
(async) load(sid) → {Promise.<object>}
载入回话
- Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
sid | 
            
            
            
                
string
            
             | 
            
            
            
                 Id  | 
        
Returns:
- Type:
 - 
        
Promise.<object> 
保存的回话
(async) loadAndRemove(sid) → {Promise.<object>}
载入并删除回话
- Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
sid | 
            
            
            
                
string
            
             | 
            
            
            
                 Id  | 
        
Returns:
- Type:
 - 
        
Promise.<object> 
保存的会话
(async) remove(sid) → {Promise.<void>}
删除回话
- Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
sid | 
            
            
            
                
string
            
             | 
            
            
            
                 Id  | 
        
Returns:
- Type:
 - 
        
Promise.<void> 
(async) removeByIndex(data) → {Promise.<Array.<string>>}
删除与索引一致的所有回话
- Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
data | 
            
            
            
                
object
            
             | 
            
            
            
                 索引  | 
        
Returns:
- Type:
 - 
        
Promise.<Array.<string>> 
删除了的Id
(async) save(sid, data) → {Promise.<string>}
保存数据
- Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
sid | 
            
            
            
                
string
            
             | 
            
            
            
                 optional,回话id,如果没有提供则随机生成  | 
        
data | 
            
            
            
                
object
            
             | 
            
            
            
                 数据  | 
        
Returns:
- Type:
 - 
        
Promise.<string> 
sid