View Javadoc
1   /*
2    * Copyright 2016 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License, version 2.0 (the
5    * "License"); you may not use this file except in compliance with the License. You may obtain a
6    * copy of the License at:
7    *
8    * https://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software distributed under the License
11   * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing permissions and limitations under
13   * the License.
14   */
15  
16  package io.netty.handler.codec.redis;
17  
18  /**
19   * Constant values for Redis encoder/decoder.
20   */
21  final class RedisConstants {
22  
23      private RedisConstants() {
24      }
25  
26      static final int TYPE_LENGTH = 1;
27  
28      static final int EOL_LENGTH = 2;
29  
30      static final int NULL_LENGTH = 2;
31  
32      static final int NULL_VALUE = -1;
33  
34      static final int REDIS_MESSAGE_MAX_LENGTH = 512 * 1024 * 1024; // 512MB
35  
36      // 64KB is max inline length of current Redis server implementation.
37      static final int REDIS_INLINE_MESSAGE_MAX_LENGTH = 64 * 1024;
38  
39      static final int POSITIVE_LONG_MAX_LENGTH = 19; // length of Long.MAX_VALUE
40  
41      static final int LONG_MAX_LENGTH = POSITIVE_LONG_MAX_LENGTH + 1; // +1 is sign
42  
43      static final short NULL_SHORT = RedisCodecUtil.makeShort('-', '1');
44  
45      static final short EOL_SHORT = RedisCodecUtil.makeShort('\r', '\n');
46  }