Defined in: src/doc/doc.js:1446
Module: dpzeus

方法

cacheClear

cacheClear
(
  • opts
)
Object deprecated

Defined in src/doc/doc.js:1529

Available since 0.3.0

清空所有cache

参数:

opts Object
opts.success Function

成功后的回调方法

opts.fail Function

失败后的回调方法

参数名类型标识描述
opts Object
参数名类型标识描述
success Function

成功后的回调方法

fail Function

失败后的回调方法

Returns:

[Object]
{
        status: <Number>,
}

Example:

<html>
    <h1>清空所有cache</h1>
</html>
<script>
DPZeus.cacheClear({
    success:function(data){
        alert(JSON.stringify(data));
    },
    fail:function(error){
        alert(JSON.stringify(error));
    }
});
</script>

cacheDelete

cacheDelete
(
  • opts
)
Object deprecated

Defined in src/doc/doc.js:1507

Available since 0.3.0

删除一条cache

参数:

opts Object
opts.key String

cache的键名称

opts.success Function

成功后的回调方法

opts.fail Function

失败后的回调方法

参数名类型标识描述
opts Object
参数名类型标识描述
key String

cache的键名称

success Function

成功后的回调方法

fail Function

失败后的回调方法

Returns:

[Object]
{
 status: <Number>,
}

Example:

<html>
    <h1>删除一条cache</h1>
</html>
<script>
DPZeus.cacheDelete({
    key:'test1',
    success:function(data){
        alert(JSON.stringify(data));
    },
    fail:function(error){
        alert(JSON.stringify(error));
    }
});
</script>

cacheLoad

cacheLoad
(
  • opts
)
Object deprecated

Defined in src/doc/doc.js:1483

Available since 0.3.0

读取cache

参数:

opts Object
opts.key String

cache的键名称

opts.success Function

成功后的回调方法

opts.fail Function

失败后的回调方法

参数名类型标识描述
opts Object
参数名类型标识描述
key String

cache的键名称

success Function

成功后的回调方法

fail Function

失败后的回调方法

Returns:

[Object]
{
 status: <Number>,
 value: <String>,
 expired: <Boolean>,
}

Example:

<html>
    <h1>读取cache</h1>
</html>
<script>
DPZeus.cacheLoad({
    key:'test1',
    success:function(result){
        alert(JSON.stringify(result));
    },
    fail:function(result){
        alert(JSON.stringify(result));
    }
});
</script>

cacheSave

cacheSave
(
  • opts
)
Object deprecated

Defined in src/doc/doc.js:1458

Available since 0.3.0

存储cache

参数:

opts Object
opts.key String

cache的键名称

opts.value: String

键对应的value值

opts.expiration Integer

失效时间可选,默认无穷大

opts.temp Boolean

是否是临时存储 可选,默认false,如为true的话,每次启动清空

opts.success Function

成功后的回调方法

opts.fail Function

失败后的回调方法

参数名类型标识描述
opts Object
参数名类型标识描述
key String

cache的键名称

value: String

键对应的value值

expiration Integer

失效时间可选,默认无穷大

temp Boolean

是否是临时存储 可选,默认false,如为true的话,每次启动清空

success Function

成功后的回调方法

fail Function

失败后的回调方法

Returns:

[Object]
{
 status: <Number>
}

Example:

<html>
    <h1>存储cache</h1>
</html>
<script>
DPZeus.cacheSave({
    key:'test1',
    value:'test1Value',
    //temp: true,
    //expiration: 30000,
    success:function(result){
        alert(JSON.stringify(result));
    },
    fail:function(result){
        alert(JSON.stringify(result));
    }
});
</script>

retrieve

retrieve
(
  • opts
)
Object

Defined in src/doc/doc.js:1570

取值

参数:

opts Object
opts.key String
参数名类型标识描述
opts Object
参数名类型标识描述
key String

Returns:

[Object]
{
 value: <String>
}

Example:

<html>
    <h1>取值</h1>
</html>
<script>
//bizname用来区分不用业务的存储空间
DPZeus.config({
    bizname: 'dpzeus-demo'
});
DPZeus.retrieve({
    key: "store", // 等同于 "group:lastVisit"
    success: function(result){
        var lastVisit =  result.value //获取lastVisit的值
        //log('retrieve group:lastVisit success', result);
        alert(JSON.stringify(result));
    },
    fail: function(error){
        //log('retrieve group:lastVisit fail', error);
        alert(JSON.stringify(error));
    }
});
</script>

store

store
(
  • opts
)
Object

Defined in src/doc/doc.js:1550

存值
点评侧数据存储在native中,可与native交互,更新app不会丢失
为了避免命名冲突,使用前需要先使用KNB.config({bizname:"your-biz-name"});进行配置
注意: 2.0.0 需添加config的配置,已经默认添加

参数:

opts Object
opts.key String

存值的key

opts.value String

存值的value

opts.success Function

设置成功的回调

opts.fail String

设置失败的回调

参数名类型标识描述
opts Object
参数名类型标识描述
key String

存值的key

value String

存值的value

success Function

设置成功的回调

fail String

设置失败的回调

Returns:

[Object]

Base

Example:

<html>
    <h1>存值
点评侧数据存储在native中,可与native交互,更新app不会丢失
为了避免命名冲突,使用前需要先使用KNB.config({bizname:"your-biz-name"});进行配置
注意: 2.0.0 需添加config的配置,已经默认添加</h1>
</html>
<script>
DPZeus.config({
    bizname: 'dpzeus-demo'
});
DPZeus.store({
    key:'store',
    value:'storeValue',
    success:function(result){
        alert(JSON.stringify(result));
    },
    fail:function(result){
        alert(JSON.stringify(result));
    }
});
</script>