Skip to content

Package: Commands

Commands

Coverage

1: /*
2: * Copyright (c) 2012, 2017 Oracle and/or its affiliates. All rights reserved.
3: *
4: * This program and the accompanying materials are made available under the
5: * terms of the Eclipse Public License v. 2.0, which is available at
6: * http://www.eclipse.org/legal/epl-2.0.
7: *
8: * This Source Code may also be made available under the following Secondary
9: * Licenses when the conditions for such availability set forth in the
10: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11: * version 2 with the GNU Classpath Exception, which is available at
12: * https://www.gnu.org/software/classpath/license.html.
13: *
14: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15: */
16:
17: package org.glassfish.grizzly.memcached;
18:
19: import java.net.SocketAddress;
20: import java.util.Map;
21:
22: /**
23: * Defines basic commands of the memcached
24: *
25: * See http://code.google.com/p/memcached/wiki/NewCommands and http://code.google.com/p/memcached/wiki/BinaryProtocolRevamped
26: * And the {@code noReply} parameter means memcached's quiet command such as GetQ, SetQ and etc...
27: *
28: * @author Bongjae Chang
29: */
30: public interface Commands<K, V> {
31: // storage commands
32:
33: public boolean set(final K key, final V value, final int expirationInSecs, final boolean noReply);
34:
35: public boolean add(final K key, final V value, final int expirationInSecs, final boolean noReply);
36:
37: public boolean replace(final K key, final V value, final int expirationInSecs, final boolean noReply);
38:
39: public boolean append(final K key, final V value, final boolean noReply);
40:
41: public boolean prepend(final K key, final V value, final boolean noReply);
42:
43: public boolean cas(final K key, final V value, final int expirationInSecs, final long cas, final boolean noReplys);
44:
45:
46: // retrieval commands
47:
48: public V get(final K key, final boolean noReply);
49:
50: public ValueWithKey<K, V> getKey(final K key, final boolean noReply);
51:
52: public ValueWithCas<V> gets(final K key, final boolean noReply);
53:
54: public V gat(final K key, final int expirationInSecs, final boolean noReplys);
55:
56: public boolean delete(final K key, final boolean noReply);
57:
58: public long incr(final K key, final long delta, final long initial, final int expirationInSecs, final boolean noReply);
59:
60: public long decr(final K key, final long delta, final long initial, final int expirationInSecs, final boolean noReply);
61:
62:
63: // security
64:
65: public String saslAuth(final SocketAddress address, final String mechanism, final byte[] data);
66:
67: public String saslStep(final SocketAddress address, final String mechanism, final byte[] data);
68:
69: public String saslList(final SocketAddress address);
70:
71:
72: // statistics
73:
74: public Map<String, String> stats(final SocketAddress address);
75:
76: public Map<String, String> statsItems(final SocketAddress address, final String item);
77:
78:
79: // etc...
80:
81: public boolean quit(final SocketAddress address, final boolean noReply);
82:
83: public boolean flushAll(final SocketAddress address, final int expirationInSecs, final boolean noReply);
84:
85: public boolean touch(final K key, final int expirationInSecs);
86:
87: public boolean noop(final SocketAddress addresss);
88:
89: public boolean verbosity(final SocketAddress address, final int verbosity);
90:
91: public String version(final SocketAddress address);
92: }