Inserts a document into the database for a given key, failing if it exists.
Namespace: CouchbaseAssembly: Couchbase.NetClient (in Couchbase.NetClient.dll) Version: 2.0.0.0 (2.0.0.0)
Syntaxpublic IOperationResult<T> Insert<T>(
string key,
T value,
uint expiration
)
public IOperationResult<T> Insert<T>(
string key,
T value,
uint expiration
)
Public Function Insert(Of T) (
key As String,
value As T,
expiration As UInteger
) As IOperationResult(Of T)
Public Function Insert(Of T) (
key As String,
value As T,
expiration As UInteger
) As IOperationResult(Of T)
public:
generic<typename T>
virtual IOperationResult<T>^ Insert(
String^ key,
T value,
unsigned int expiration
) sealed
public:
generic<typename T>
virtual IOperationResult<T>^ Insert(
String^ key,
T value,
unsigned int expiration
) sealed
abstract Insert :
key : string *
value : 'T *
expiration : uint32 -> IOperationResult<'T>
override Insert :
key : string *
value : 'T *
expiration : uint32 -> IOperationResult<'T>
abstract Insert :
key : string *
value : 'T *
expiration : uint32 -> IOperationResult<'T>
override Insert :
key : string *
value : 'T *
expiration : uint32 -> 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.
Type Parameters- T
- The Type of the value to be inserted.
Return Value
Type:
IOperationResult<T>An object implementing the
IOperationResult<T>interface.
Implements
IBucket.Insert<T>(String, T, UInt32)
RemarksExpirations 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