# 过期时间操作

## 检索文档并设置失效时间

失效时间单位是秒

```javascript
bucket.getAndTouch("xiaoming",4, function(err, result) {
    console.log(result);
});
```

console打印出来获取的数据，4秒钟之后数据自动删除．

另一个方法：

```sql
bucket.touch("xiaoming1",60, function(err, result) {
    console.log(result);
});
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://couchbase.shujuwajue.com/shi-yong-node-js-ke-hu-duan/ji-ben-cao-zuo/guo-qi-shi-jian-cao-zuo.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
