lib/aerospike/client.rb
##
# Removes records in the specified namespace/set efficiently.
#
# This method is orders of magnitude faster than deleting records one at a
# time. It requires Aerospike Server version 3.12 or later. See
# https://www.aerospike.com/docs/reference/info#truncate for further
# information.
#
# This asynchronous server call may return before the truncate is complete.
# The user can still write new records after the server call returns
# because new records will have last update times greater than the truncate
# cut-off (set at the time of the truncate call.)
#
# If no policy options are provided, +@default_info_policy+ will be used.
Removes records in the specified namespace/set efficiently.
This method is orders of magnitude faster than deleting records one at a
time. It requires Aerospike Server version 3.12 or later.

This asynchronous server call may return before the truncate is complete.
The user can still write new records after the server call returns
because new records will have last update times greater than the truncate
cut-off (set at the time of the truncate call.)

If no policy options are provided, +@default_info_policy+ will be used.
Removes records in the specified namespace / set efficiently . This method is orders of magnitude faster than deleting records one at a time . It requires Aerospike Server version 3 . 12 or later . This asynchronous server call may return before the truncate is complete . The user can still write new records after the server call returns because new records will have last update times greater than the truncate cut - off ( set at the time of the truncate call . ) If no policy options are provided + @default_info_policy + will be used .
def truncate(namespace, set_name = nil, before_last_update = nil, options = {})
      policy = create_policy(options, Policy, default_info_policy)
      str_cmd = "truncate:namespace=#{namespace}"
      str_cmd << ";set=#{set_name}" unless set_name.to_s.strip.empty?
      if before_last_update
        lut_nanos = (before_last_update.to_f * 1_000_000_000.0).round
        str_cmd << ";lut=#{lut_nanos}"
      elsif supports_feature?(Aerospike::Features::LUT_NOW)
        str_cmd << ";lut=now"
      end
      response = send_info_command(policy, str_cmd).upcase
      return if response == 'OK'
      raise Aerospike::Exceptions::Aerospike.new(Aerospike::ResultCode::SERVER_ERROR, "Truncate failed: #{response}")
    end
def truncate ( namespace , set_name = nil , before_last_update = nil , options = { } ) policy = create_policy ( options , Policy , default_info_policy ) str_cmd = "truncate:namespace=#{namespace}" str_cmd << ";set=#{set_name}" unless set_name . to_s . strip . empty? if before_last_update lut_nanos = ( before_last_update . to_f * 1_000_000_000.0 ) . round str_cmd << ";lut=#{lut_nanos}" elsif supports_feature? ( Aerospike :: Features :: LUT_NOW ) str_cmd << ";lut=now" end response = send_info_command ( policy , str_cmd ) . upcase return if response == 'OK' raise Aerospike :: Exceptions :: Aerospike . new ( Aerospike :: ResultCode :: SERVER_ERROR , "Truncate failed: #{response}" ) end
Removes records in the specified namespace/set efficiently.
Removes records in the specified namespace / set efficiently .
# Servers >= 4.3.1.4 require lut argument # Send index command to one node. That node will distribute the command to other nodes.
namespace
set_name
before_last_update
options