code point : 用来表示unicode编码表中的字符character的一个十六进制的数字(日常使用中十六进制、十进制数字都是可以的),a hexadecimal number that is used to represent that character in computer data, 如 :
code point0x4E00 对应的 character 为 一 ;
code point0x41 对应的 character 为 A ;
code unit : 表示一个unicode编码表中的字符character所需要的二进制位数bits,A Unicode code unit is a bit size used by a particular Unicode encoding,For example UTF-8 has a code unit size of 8 bits and UTF-16 has 16 and UTF-32 has 32,也可以理解为识别一个unicode字符所需要的二进制位数bits,不够的会被舍弃掉
An important part of the localization process is to localize all of the text strings displayed by your application. By their nature, strings located in nib files can be readily localized along with the rest of the nib file contents. Strings embedded in your code, however, must be extracted, localized, and then reinserted back into your code. To simplify this process—and to make the maintenance of your code easier—OS X and iOS provide the infrastructure needed to separate strings from your code and place them into resource files where they can be localized easily.
Resource files that contain localizable strings are referred to as strings files because of their filename extension, which is .strings. You can create strings files manually or programmatically depending on your needs. The standard strings file format consists of one or more key-value pairs along with optional comments. The key and value in a given pair are strings of text enclosed in double quotation marks and separated by an equal sign. (You can also use a property list format for strings files. In such a case, the top-level node is a dictionary and each key-value pair of that dictionary is a string entry.)
Listing 2-1 shows a simple strings file that contains non-localized entries for the default language. When you need to display a string, you pass the string on the left to one of the available string-loading routines. What you get back is the matching value string containing the text translation that is most appropriate for the current user. For the development language, it is common to use the same string for both the key and value, but doing so is not required.
Listing 2-1 A simple strings file
/* Insert Element menu item */
"Insert Element" = "Insert Element";
/* Error string used for unknown error types. */
"ErrorString_1" = "An unknown error occurred.";
A typical application has at least one strings file per localization, that is, one strings file in each of the bundle’s.lproj subdirectories. The name of the default strings file is Localizable.strings but you can create strings files with any file name you choose. Creating strings files is discussed in more depth in Creating Strings Resource Files.
The loading of string resources (both localized and nonlocalized) ultimately relies on the bundle and internationalization support found in both OS X and iOS. For information about bundles, see Bundle Programming Guide. For more information about internationalization and localization, see Internationalization and Localization Guide.
Creating Strings Resource Files
Although you can create strings files manually, it is rarely necessary to do so. If you write your code using the appropriate string-loading macros, you can use the genstrings command-line tool to extract those strings and create strings files for you.
The following sections describe the process of how to set up your source files to facilitate the use of the genstrings tool. For detailed information about the tool, see genstrings man page.
Choosing Which Strings to Localize
When it comes to localizing your application’s interface, it is not always appropriate to localize every string used by your application. Translation is a costly process, and translating strings that are never seen by the user is a waste of time and money. Strings that are not displayed to the user, such as notification names used internally by your application, do not need to be translated. Consider the following example:
if (CFStringHasPrefix(value, CFSTR("-")) { CFArrayAppendValue(myArray, value);};
In this example, the string “-” is used internally and is never seen by the user; therefore, it does not need to be placed in a strings file.
The following code shows another example of a string the user would not see. The string "%d %d %s" does not need to be localized, since the user never sees it and it has no effect on anything that the user does see.
Because nib files are localized separately, you do not need to include strings that are already located inside of a nib file. Some of the strings you should localize, however, include the following:
Strings that are programmatically added to a window, panel, view, or control and subsequently displayed to the user. This includes strings you pass into standard routines, such as those that display alert boxes.
Menu item title strings if those strings are added programmatically. For example, if you use custom strings for the Undo menu item, those strings should be in a strings file.
Error messages that are displayed to the user.
Any boilerplate text that is displayed to the user.
You use these macros in your source code to load strings from one of your application’s strings files. The macros take the user’s current language preferences into account when retrieving the actual string value. In addition, the genstrings tool searches for these macros and uses the information they contain to build the initial set of strings files for your application.
At some point during your development, you need to create the strings files needed by your code. If you wrote your code using the Core Foundation and Foundation macros, the simplest way to create your strings files is using the genstrings command-line tool. You can use this tool to generate a new set of strings files or update a set of existing files based on your source code.
To use the genstrings tool, you typically provide at least two arguments:
A list of source files
An optional output directory
The genstrings tool can parse C, Objective-C, and Java code files with the .c, .m, or .java filename extensions. Although not strictly required, specifying an output directory is recommended and is where genstrings places the resulting strings files. In most cases, you would want to specify the directory containing the project resources for your development language.
The following example shows a simple command for running the genstrings tool. This command causes the tool to parse all Objective-C source files in the current directory and put the resulting strings files in the en.lproj subdirectory, which must already exist.
genstrings -o en.lproj *.m
The first time you run the genstrings tool, it creates a set of new strings files for you. Subsequent runs replace the contents of those strings files with the current string entries found in your source code. For subsequent runs, it is a good idea to save a copy of your current strings files before running genstrings. You can then diff the new and old versions to determine which strings were added to (or changed in) your project. You can then use this information to update any already localized versions of your strings files, rather than replacing those files and localizing them again.
Within a single strings file, each key must be unique. Fortunately, the genstrings tool is smart enough to coalesce any duplicate entries it finds. When it discovers a key string used more than once in a single strings file, the tool merges the comments from the individual entries into one comment string and generates a warning. (You can suppress the duplicate entries warning with the -q option.) If the same key string is assigned to strings in different strings files, no warning is generated.
For more information about using the genstrings tool, see the genstrings man page.
Creating Strings Files Manually
Although the genstrings tool is the most convenient way to create strings files, you can also create them manually. To create a strings file manually, create a new file in TextEdit (or your preferred text-editing application) and save it using the Unicode UTF-8 encoding. (When saving files, TextEdit usually chooses an appropriate encoding by default. To force a specific encoding, you must change the save options in the application preferences.) The contents of this file consists of a set of key-value pairs along with optional comments describing the purpose of each key-value pair. Key and value strings are separated by an equal sign, and the entire entry must be terminated with a semicolon character. By convention, comments are enclosed inside C-style comment delimiters (/* and */) and are placed immediately before the entry they describe.
Listing 2-2 shows the basic format of a strings file. The entries in this example come from the English version of the Localizable.strings file from the TextEdit application. The string on the left side of each equal sign represents the key, and the string on the right side represents the value. A common convention when developing applications is to use a key name that equals the value in the language used to develop the application. Therefore, because TextEdit was developed using the English language, the English version of the Localizable.strings file has keys and values that match.
Listing 2-2 Strings localized for English
/* Menu item to make the current document plain text */
"Make Plain Text" = "Make Plain Text";
/* Menu item to make the current document rich text */
"Make Rich Text" = "Make Rich Text";
Listing 2-3 shows the German translation of the same entries. These entries also live inside a file called Localizable.strings, but this version of the file is located in the German language project directory of the TextEdit application. Notice that the keys are still in English, but the values assigned to those keys are in German. This is because the key strings are never seen by end users. They are used by the code to retrieve the corresponding value string, which in this case is in German.
Listing 2-3 Strings localized for German
/* Menu item to make the current document plain text */
"Make Plain Text" = "In reinen Text umwandeln";
/* Menu item to make the current document rich text */
"Make Rich Text" = "In formatierten Text umwandeln";
Detecting Non-localizable Strings
AppKit–based applications can take advantage of built-in support to detect strings that do not need to be localized and those that need to be localized but currently are not. To use this built-in support, set user defaults or add launch arguments when running your app. Specify a Boolean value to indicate whether the user default should be enabled or disabled. The available user defaults are as follows:
The NSShowNonLocalizableStrings user default identifies strings that are not localizable. The strings are logged to the shell in upper case. This option occasionally generates some false positives but is still useful overall.
The NSShowNonLocalizedStrings user default locates strings that were meant to be localized but could not be found in the application’s existing strings files. You can use this user default to catch problems with out-of-date localizations.
For example, to use the NSShowNonLocalizedStrings user default with the TextEdit application, enter the following in Terminal:
The Core Foundation and Foundation frameworks provide macros for retrieving both localized and nonlocalized strings stored in strings files. Although the main purpose of these macros is to load strings at runtime, they also serve a secondary purpose by acting as markers that the genstrings tool can use to locate your application’s string resources. It is this second purpose that explains why many of the macros let you specify much more information than would normally be required for loading a string. The genstrings tool uses the information you provide to create or update your application’s strings files automatically. Table 2-1 lists the types of information you can specify for these routines and describes how that information is used by the genstrings tool.
Table 2-1 Common parameters found in string-loading routines
Parameter
Description
Key
The string used to look up the corresponding value. This string must not contain any characters from the extended ASCII character set, which includes accented versions of ASCII characters. If you want the initial value string to contain extended ASCII characters, use a routine that lets you specify a default value parameter. (For information about the extended ASCII character set, see the corresponding Wikipedia entry.)
Table name
The name of the strings file in which the specified key is located. The genstrings tool interprets this parameter as the name of the strings file in which the string should be placed. If no table name is provided, the string is placed in the default Localizable.strings file. (When specifying a value for this parameter, include the filename without the .strings extension.)
A .strings file whose table name ends with .nocache—for example ErrorNames.nocache.strings—will not have its contents cached by NSBundle.
Default value
The default value to associate with a given key. If no default value is specified, the genstrings tool uses the key string as the initial value. Default value strings may contain extended ASCII characters.
Comment
Translation comments to include with the string. You can use comments to provide clues to the translation team about how a given string is used. The genstrings tool puts these comments in the strings file and encloses them in C-style comment delimiters (/* and */) immediately above the associated entry.
Bundle
An NSBundle object or CFBundleRef type corresponding to the bundle containing the strings file. You can use this to load strings from bundles other than your application’s main bundle. For example, you might use this to load localized strings from a framework or plug-in.
When you request a string from a strings file, the string that is returned depends on the available localizations (if any). The Cocoa and Core Foundation macros use the built-in bundle internationalization support to retrieve the string whose localization matches the user’s current language preferences. As long as your localized resource files are placed in the appropriate language-specific project directories, loading a string with these macros should yield the appropriate string automatically. If no appropriate localized string resource is found, the bundle’s loading code automatically chooses the appropriate nonlocalized string instead.
For information about internationalization in general and how to create language-specific project directories, see Internationalization and Localization Guide. For information about the bundle structure and how resource files are chosen from a bundle directory, see Bundle Programming Guide.
Using the Core Foundation Framework
The Core Foundation framework defines a single function and several macros for loading localized strings from your application bundle. The
console.log(String.fromCodePoint(42))
console.log(String.fromCodePoint(65, 90))
console.log(String.fromCodePoint(0x404))
console.log(String.fromCodePoint(1028))
console.log(String.fromCodePoint(0x2F804))
console.log(String.fromCodePoint(194564))
//输出:
*
AZ
Є
Є
?
?
//字典顺序比较大小
public int compareTo(String anotherString)
//忽略大小写进行比较
public int compareToIgnoreCase(String str)
//相等判断,类型也要相同,为String类
public boolean equals(Object anObject) { }
//相等判断,忽略大小写,'A'和'a'相等
public boolean equalsIgnoreCase(String anotherString) { }
//相等判断,内容相等,类型可能不相同
public boolean contentEquals(StringBuffer sb) { }
public boolean contentEquals(CharSequence cs) { }
例子
//相同长度,某个位置处字符不同
String str1 = "A";
String str2 = "a";
int result = str1.compareTo(str2);
Log.d("差值:", String.valueOf(result));
if (result == 0) {
Log.d("排序:", "相等");
} else if (result < 0) {
Log.d("排序:", "位于前面");
} else {
Log.d("排序:", "位于后面");
}
//输出:
-32
位于前面
//长度不同的比较
String str1 = "aA";
String str2 = "a";
int result = str1.compareTo(str2);
Log.d("差值:", String.valueOf(result));
if (result == 0) {
Log.d("排序:", "相等");
} else if (result < 0) {
Log.d("排序:", "位于前面");
} else {
Log.d("排序:", "位于后面");
}
//输出:
1
位于后面
//索引位置处字符不同,长度不同
String str1 = "Aa";
String str2 = "a";
int result = str1.compareTo(str2);
Log.d("差值:", String.valueOf(result));
if (result == 0) {
Log.d("排序:", "相等");
} else if (result < 0) {
Log.d("排序:", "位于前面");
} else {
Log.d("排序:", "位于后面");
}
//输出:
-32
位于前面
//忽略大小写的比较
String str1 = "A";
String str2 = "a";
int result = str1.compareToIgnoreCase(str2);
Log.d("差值:", String.valueOf(result));
if (result == 0) {
Log.d("排序:", "相等");
} else if (result < 0) {
Log.d("排序:", "位于前面");
} else {
Log.d("排序:", "位于后面");
}
//输出:
0
相等
var str = 'hello world';
var result = str.includes('hello');
var result2 = str.includes('me');
console.log(result);
console.log(result2);
//输出:
true
false
NSString *str = @"one";
NSString *str2 = [str stringByAppendingString:@"two"];
NSString *str3 = [str stringByAppendingFormat:@"%@ hello %d", str2, 3];
NSLog(@"%@", str2);
NSLog(@"%@", str3);
//输出:
onetwo
oneonetwo hello 3
NSString *str = @"one";
NSString *result = [str stringByPaddingToLength:10 withString:@"+" startingAtIndex:0];
NSLog(@"%@", result);
NSLog(@"%ld", result.length);
//输出:
str length string index result result.length
one 10 + 0 one+++++++ 10
one 3 + 0 one 3
one 2 + 0 on 2
one 0 + 0 0
one 0 + 1 crash了
one 6 +- 1 one-+- 6
NSMutableString *str = [NSMutableString string];
NSLog(@"%@", str);
[str appendString:@"two"];
NSLog(@"%@", str);
[str appendFormat:@"hello %d", 3];
NSLog(@"%@", str);
[str insertString:@"first " atIndex:0];
NSLog(@"%@", str);
//输出:
two
twohello 3
first twohello 3
小结
NSString不会改变原来字符串的值,会返回一个新的值
NSMutableString是对原来字符串进行处理,不会返回新值
Java concat 、format 、append 、insert
方法
//将指定字符串str拼接到“源字符串”的结尾
public String concat(String str)
//类方法,格式化拼接字符串
public static String format(String format,
Object... args)
//类方法,格式化拼接字符串,本地化的
public static String format(Locale l,
String format,
Object... args)
//append -----
public StringBuilder append(Object obj)
public StringBuilder append(String str)
public StringBuilder append(StringBuffer sb)
public StringBuilder append(CharSequence s)
public StringBuilder append(CharSequence s, int start, int end)
public StringBuilder append(char[] str)
public StringBuilder append(char[] str, int offset, int len)
public StringBuilder append(boolean b)
public StringBuilder append(char c)
public StringBuilder append(int i)
public StringBuilder append(long lng)
public StringBuilder append(float f)
public StringBuilder append(double d)
public StringBuilder appendCodePoint(int codePoint)
//insert
public StringBuilder insert(int offset, boolean b)
public StringBuilder insert(int offset, char c)
public StringBuilder insert(int offset, int i)
public StringBuilder insert(int offset, long l)
public StringBuilder insert(int offset, float f)
public StringBuilder insert(int offset, double d)
var str = "";
str += "one";
console.log(str)
//输出:
one
//重复次数
var str = 'hello';
var result = str.repeat(2);
var result2 = str.repeat(0);
// var result3 = str.repeat(-1);
console.log(result);
console.log(result2);
// console.log(result3);
console.log("++++++++")
//输出:
hellohello
++++++++
var str = 'hello';
var result = str.concat(' ', 'world');
console.log(result);
//输出:
hello world
/**
* 获取 index 位置处的 unicode unit 的数字表示形式
* 1、index 超过范围 [0, length - 1) 会crash ,因为范围越界了
*/
- (unichar)characterAtIndex:(NSUInteger)index;
例子
NSString *str = @"hello world!";
unichar ch = [str characterAtIndex:1];
NSLog(@"%d -- %@", ch, [[NSString alloc] initWithCharacters:&ch length:1]);
//输出:
101 -- e
//当 index 为 20 时,crash 了,
Terminating app due to uncaught exception 'NSRangeException', reason: '-[__NSCFConstantString characterAtIndex:]: Range or index out of bounds'
小结
Java charAt 、codePointAt
方法
// 返回指定索引处的 char 值。索引范围为从 0 到 length() - 1。序列的第一个 char 值位于索引 0 处,第二个位于索引 1 处,依此类推,这类似于数组索引;如果 index 参数为负或小于此字符串的长度,会抛出异常
public char charAt(int index)
// 返回指定索引处的字符(Unicode 代码点)。索引引用 char 值(Unicode 代码单元),其范围从 0 到 length() - 1
public int codePointAt(int index)
例子
String str = "hello world!";
char ch = str.charAt(1);
Log.e("获取", String.valueOf(ch));
// 输出:
E/获取: e
String str = "hello world!";
int point = str.codePointAt(1);
Log.e("获取", String.valueOf(point));
// 输出:
E/获取: 101
小结
JS charAt 、charCodeAt 、 codePointAt
方法
/**
* 获取index位置处的 UTF-16 code unit 的字符串形式
* 1、不填写参数,默认获取 0 位置处的字符
* 2、index 超过 “源字符串” 的范围,返回空字符串 ""
*/
character = str.charAt(index)
/**
* 获取 index 处 UTF-16 code unit 的 code point 所代表的数字
* 1、index 超过范围 返回 NaN
*/
str.charCodeAt(index)
/**
* 获取 index 位置处的 UTF-16 code unit 的 code point 的数字形式
* 1、如果 index 超过字符串的范围,返回undefined
*/
str.codePointAt(pos)
例子
var str = "hello world"
var character = str.charAt()
var character1 = str.charAt(0)
var character2 = str.charAt(20)
console.log(character)
console.log(character1)
console.log(character2)
console.log("-----")
//输出:
h
h
-----
var str = "hello world"
var result = str.charCodeAt(0)
var result1 = str.charCodeAt(20)
console.log(result)
console.log(result1)
//输出:
104
NaN
var str = "hello world"
var result = str.codePointAt(0)
var result1 = str.codePointAt(20)
console.log(result)
console.log(result1)
//输出:
104
undefined
// 在”源字符串“中查找 字符串str 或者 ch代表的Unicode 代码点代表的字符 ”第一次“ 出现的位置,如果未出现该字符,则返回 -1
public int indexOf(String str)
public int indexOf(String str, int fromIndex)
public int indexOf(int ch)
public int indexOf(int ch, int fromIndex)
// 在”源字符串“中查找 字符串str 或者 ch代表的Unicode 代码点代表的字符 ”最后一次“ 出现的位置,如果未出现该字符,则返回 -1
public int lastIndexOf(String str)
public int lastIndexOf(String str, int fromIndex)
public int lastIndexOf(int ch)
public int lastIndexOf(int ch, int fromIndex)
//查找字符串常量并替换
var str = "hello world 01123 AND HELLO WORLD 321445"
var result = str.replace("l", "+")
console.log(str)
console.log(result)
//输出:
hello world 01123 AND HELLO WORLD 321445
he+lo world 01123 AND HELLO WORLD 321445
//正则表达式替换所有查找到的内容
var str = "hello world 01123 AND HELLO WORLD 321445"
var result = str.replace(/l/g, "+")
console.log(str)
console.log(result)
//输出:
hello world 01123 AND HELLO WORLD 321445
he++o wor+d 01123 AND HELLO WORLD 321445
//忽略大小写的,使用真正表达式替换所有查找到的内容
var str = "hello world 01123 AND HELLO WORLD 321445"
var result = str.replace(/l/gi, "+")
console.log(str)
console.log(result)
//输出:
hello world 01123 AND HELLO WORLD 321445
he++o wor+d 01123 AND HE++O WOR+D 321445
var str = "hello world 987 . HELLO WORLD"
var result = str.search(/./)
var result2 = str.search(/[.]/)
console.log(result)
console.log(result2)
//输出:
0
16
\d : 表示匹配任意的阿拉伯数字,即 0-9,\d 和 [0-9] 两者等价
var str = "hello world 987 . HELLO WORLD"
var result = str.search(/\d/)
var result2 = str.search(/[0-9]/)
console.log(result)
console.log(result2)
//输出:
12
12
\D : 表示匹配任意的非阿拉伯数字,\D 和 [^0-9] 两者等价
var str = "hello world 987 . HELLO WORLD"
var result = str.search(/\D/)
var result2 = str.search(/[^0-9]/)
console.log(result)
console.log(result2)
//输出:
0
0
var str = "% hello WORLD _ . "
var result = str.search(/\w/)
var result2 = str.search(/[A-Za-z0-9_]/)
console.log(result)
console.log(result2)
//输出:
2
2
var str = "hello % WORLD _ . "
var result = str.search(/\W/)
var result2 = str.search(/[^A-Za-z0-9_]/)
console.log(result)
console.log(result2)
//输出:
5
5
var str = "hello % WORLD _ . "
var result = str.search(/\s/)
var result2 = str.search(/`[ \f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]`/)
console.log(result)
console.log(result2)
//输出:
5
5
var str = "hello % WORLD _ . "
var result = str.search(/\S/)
var result2 = str.search(/[^ `[^ \f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]`/)
console.log(result)
console.log(result2)
//输出:
0
0
\t : 匹配一个水平制表符(tab)
\v : 匹配一个垂直制表符(vertical tab)
\r : 匹配一个回车符(carriage return)
\n : 匹配一个换行符(linefeed)
\f : 匹配一个换页符(form-feed)
[\b] : 匹配一个退格符(backspace)(不要与 \b 混淆)
\0 : 匹配一个 NUL 字符。不要在此后面跟小数点
\cX : X 是 A - Z 的一个字母。匹配字符串中的一个控制字符
\xhh : 匹配编码为 hh (两个十六进制数字)的字符
\uhhhh : 匹配 Unicode 值为 hhhh (四个十六进制数字)的字符
var str = "hello ɀ 013a"
var result = str.search(/\u0240/)
var result2 = str.search(/\u0068/) //u0068 对应的字符 为 h
console.log(result)
console.log(result2)
//输出:
6
0
public static String valueOf(boolean b)
public static String valueOf(char c)
public static String valueOf(int i)
public static String valueOf(long l)
public static String valueOf(float f)
public static String valueOf(double d)
@property (readonly) NSStringEncoding fastestEncoding; // Result in O(1) time; a rough estimate
@property (readonly) NSStringEncoding smallestEncoding; // Result in O(n) time; the encoding in which the string is most compact
@property (class, readonly) const NSStringEncoding *availableStringEncodings;
@property (class, readonly) NSStringEncoding defaultCStringEncoding; // Should be rarely used
+ (NSString *)localizedNameOfStringEncoding:(NSStringEncoding)encoding;
字节大小
方法
//是否可以转化为相应的编码方式
- (BOOL)canBeConvertedToEncoding:(NSStringEncoding)encoding;
//“预估”转化为enc编码方式的所占的字节大小
- (NSUInteger)maximumLengthOfBytesUsingEncoding:(NSStringEncoding)enc; // Result in O(1) time; the estimate may be way over what's needed. Returns 0 on error (overflow)
//“准确”计算转化为enc编码方式所占的字节大小
- (NSUInteger)lengthOfBytesUsingEncoding:(NSStringEncoding)enc; // Result in O(n) time; the result is exact. Returns 0 on error (cannot convert to specified encoding, or overflow)
如果在使用JAXB把xml文件unmarshal成vo(XSD自动生成的vo)时碰到如下错误:
org.xml.sax.saxparseexception : premature end of file
很有可能时你直接读取文件为inputstream,然后将inputstream作为构建unmarshal需要的source参数。InputSource inputSource = new In
servlet 搞java web开发的人一定不会陌生,而且大家还会时常用到它。
下面是java官方网站上对servlet的介绍: java官网对于servlet的解释 写道
Java Servlet Technology Overview Servlets are the Java platform technology of choice for extending and enha
这两天学到事务管理这一块,结合到之前的terasoluna框架,觉得书本上讲的还是简单阿。我就把我从书本上学到的再结合实际的项目以及网上看到的一些内容,对声明式事务管理做个整理吧。我看得Spring in Action第二版中只提到了用TransactionProxyFactoryBean和<tx:advice/>,定义注释驱动这三种,我承认后两种的内容很好,很强大。但是实际的项目当中
1)nosql数据库主要由以下特点:非关系型的、分布式的、开源的、水平可扩展的。
1,处理超大量的数据
2,运行在便宜的PC服务器集群上,
3,击碎了性能瓶颈。
1)对数据高并发读写。
2)对海量数据的高效率存储和访问。
3)对数据的高扩展性和高可用性。
redis支持的类型:
Sring 类型
set name lijie
get name lijie
set na
在多节点的系统中,如何实现分布式锁机制,其中用redis来实现是很好的方法之一,我们先来看一下jedis包中,有个类名BinaryJedis,它有个方法如下:
public Long setnx(final byte[] key, final byte[] value) {
checkIsInMulti();
client.setnx(key, value);
ret