lib/lmdb/database.rb
# Return the cardinality (number of duplicates) of a given
# key. Works whether +:dupsort+ is set or not.
# @param key [#to_s] The key in question.
# @return [Integer] The number of entries under the key.
Return the cardinality (number of duplicates) of a given
key. Works whether +:dupsort+ is set or not.
Return the cardinality ( number of duplicates ) of a given key . Works whether + : dupsort + is set or not .
def cardinality(key)
      env.transaction true do
        return 0 unless get key
        return 1 unless dupsort?
        cursor do |c|
          c.set key
          return c.count
        end
      end
    end
def cardinality ( key ) env . transaction true do return 0 unless get key return 1 unless dupsort? cursor do | c | c . set key return c . count end end end
Return the cardinality (number of duplicates) of a given
key.
Return the cardinality ( number of duplicates ) of a given key .
The number of entries under the key.
The number of entries under the key .
Integer
key
The key in question.
The key in question .