Inserts a document into the database for a given key, failing if it exists as an asynchronous operation.
Namespace: Couchbase.CoreAssembly: Couchbase.NetClient (in Couchbase.NetClient.dll) Version: 2.1.0.0 (2.1.0.0)
Syntax Task<IOperationResult<T>> InsertAsync<T>(
string key,
T value,
uint expiration,
ReplicateTo replicateTo,
PersistTo persistTo
)
Task<IOperationResult<T>> InsertAsync<T>(
string key,
T value,
uint expiration,
ReplicateTo replicateTo,
PersistTo persistTo
)
Function InsertAsync(Of T) (
key As String,
value As T,
expiration As UInteger,
replicateTo As ReplicateTo,
persistTo As PersistTo
) As Task(Of IOperationResult(Of T))
Function InsertAsync(Of T) (
key As String,
value As T,
expiration As UInteger,
replicateTo As ReplicateTo,
persistTo As PersistTo
) As Task(Of IOperationResult(Of T))
generic<typename T>
Task<IOperationResult<T>^>^ InsertAsync(
String^ key,
T value,
unsigned int expiration,
ReplicateTo replicateTo,
PersistTo persistTo
)
generic<typename T>
Task<IOperationResult<T>^>^ InsertAsync(
String^ key,
T value,
unsigned int expiration,
ReplicateTo replicateTo,
PersistTo persistTo
)
abstract InsertAsync :
key : string *
value : 'T *
expiration : uint32 *
replicateTo : ReplicateTo *
persistTo : PersistTo -> Task<IOperationResult<'T>>
abstract InsertAsync :
key : string *
value : 'T *
expiration : uint32 *
replicateTo : ReplicateTo *
persistTo : PersistTo -> Task<IOperationResult<'T>>
Parameters
- key
- Type: System String
The unique key for indexing.
- value
- Type: T
The value for the key.
- expiration
- Type: System UInt32
The time-to-live (ttl) for the key in seconds.
- replicateTo
- Type: Couchbase ReplicateTo
The durability requirement for replication.
- persistTo
- Type: Couchbase PersistTo
The durability requirement for persistence.
Type Parameters - T
- The Type of the value to be inserted.
Return Value
Type:
Task IOperationResult T The
Task TResult object representing the asynchronous operation.
Remarks Expirations over 30 * 24 * 60 * 60 (the amount of seconds in 30 days) are interpreted as a UNIX timestamp of the date at which the document expires.
see
documentation section about expiration.
See Also