StackExchange.Redis
Scansione
Ricerca…
Sintassi
public IEnumerable<RedisKey> Keys(int database = 0, RedisValue pattern = default(RedisValue), int pageSize = CursorUtils.DefaultPageSize, long cursor = CursorUtils.Origin, int pageOffset = 0, CommandFlags flags = CommandFlags.None)
Parametri
| Parametro | Dettagli |
|---|---|
| Banca dati | Indice del database Redis a cui connettersi |
| modello | incerto |
| dimensioni della pagina | Numero di articoli da restituire per pagina |
| cursore | incerto |
| pageOffset | Numero di pagine per compensare i risultati |
| bandiere | incerto |
Osservazioni
La chiamata Keys() selezionerà il comando KEYS o SCAN base alla versione del server Redis. Ove possibile, preferirà l'uso di SCAN che restituisce un IEnumerable<RedisKey> e non blocca. KEYS tasti invece bloccheranno durante la scansione dello spazio dei tasti.
Scansione di base di tutti i tasti sul server
// Connect to a target server using your ConnectionMultiplexer instance
IServer server = conn.GetServer("localhost", 6379);
// Write out each key in the server
foreach(var key in server.Keys()) {
Console.WriteLine(key);
}
Iterare usando un cursore
// Connect to a target server using your ConnectionMultiplexer instance
IServer server = conn.GetServer("localhost", 6379);
var seq = server.Keys();
IScanningCursor scanningCursor = (IScanningCursor)seq;
// Use the cursor in some way...
Modified text is an extract of the original Stack Overflow Documentation
Autorizzato sotto CC BY-SA 3.0
Non affiliato con Stack Overflow