OC.L10N.register( "lib", { "Cannot write into \"config\" directory!" : "Không thể ghi vào thư mục \"config\"!", "See %s" : "Xem %s", "The page could not be found on the server." : "Không thể tìm thấy trang trên máy chủ.", "Email verification" : "Xác thực email", "Click the following button to confirm your email." : "Nhấn nút sau để xác nhận email của bạn.", "Click the following link to confirm your email." : "Nhấn liên kết sau để xác nhận email của bạn.", "Confirm your email" : "Xác nhận email của bạn", "Other activities" : "Hoạt động khác", "%1$s and %2$s" : "%1$s và %2$s", "%1$s, %2$s and %3$s" : "%1$s, %2$s và %3$s", "%1$s, %2$s, %3$s and %4$s" : "%1$s, %2$s, %3$s và %4$s", "%1$s, %2$s, %3$s, %4$s and %5$s" : "%1$s, %2$s, %3$s, %4$s và %5$s", "Enterprise bundle" : "Gói doanh nghiệp", "The library %s is not available." : "Thư viện %s không có sẵn.", "The following platforms are supported: %s" : "Các nền tảng sau được hỗ trợ: %s", "Server version %s or higher is required." : "Yêu cầu máy chủ phiên bản %s hoặc cao hơn.", "Server version %s or lower is required." : "Yêu cầu máy chủ phiên bản %s hoặc thấp hơn.", "Authentication" : "Xác thực", "Unknown filetype" : "Không biết kiểu tập tin", "Invalid image" : "Hình ảnh không hợp lệ", "Files" : "Tệp", "View profile" : "Xem hồ sơ", "today" : "hôm nay", "yesterday" : "hôm qua", "last month" : "tháng trước", "_%n month ago_::_%n months ago_" : ["%n tháng trước"], "next year" : "năm tới", "last year" : "năm trước", "_%n hour ago_::_%n hours ago_" : ["%n giờ trước"], "_%n minute ago_::_%n minutes ago_" : ["%n phút trước"], "seconds ago" : "vài giây trước", "File already exists" : "Tệp đã tồn tại", "Templates" : "‎Mẫu‎", "Filename contains at least one invalid character" : "Tên tệp chứa ít nhất một ký tự không hợp lệ", "__language_name__" : "Tiếng Việt", "Appearance and accessibility" : "Ngoại hình và khả năng tiếp cận", "Apps" : "Ứng dụng", "Settings" : "Thiết lập", "Log out" : "Đăng xuất", "Accounts" : "Tài khoản", "Email" : "Thư điện tử", "Phone" : "Điện thoại", "Twitter" : "Twitter", "Website" : "Website", "Address" : "Địa chỉ", "Profile picture" : "Ảnh đại diện", "About" : "Giới thiệu", "Headline" : "Tiêu đề", "Organisation" : "Tổ chức", "Role" : "Vai trò", "Additional settings" : "Cài đặt bổ sung", "Please remove the open_basedir setting within your php.ini or switch to 64-bit PHP." : "Hãy xóa thiết lập open_basedir tại tập tin cấu hình php.ini hoặc chuyển sang dùng PHP 64-bit.", "Set an admin password." : "Thiết lập mật khẩu quản trị", "%1$s via %2$s" : "%1$s thông qua %2$s", "Unknown share type" : "Loại chia sẻ không xác định", "Could not find category \"%s\"" : "không thể tìm thấy mục \"%s\"", "Sunday" : "Chủ nhật", "Monday" : "Thứ 2", "Tuesday" : "Thứ 3", "Wednesday" : "Thứ 4", "Thursday" : "Thứ 5", "Friday" : "Thứ ", "Saturday" : "Thứ 7", "Sun." : "Chủ nhật", "Mon." : "Thứ hai", "Tue." : "Thứ ba", "Wed." : "Thứ tư", "Thu." : "Thứ năm", "Fri." : "Thứ sáu", "Sat." : "Thứ bảy", "January" : "Tháng 1", "February" : "Tháng 2", "March" : "Tháng 3", "April" : "Tháng 4", "May" : "Tháng 5", "June" : "Tháng 6", "July" : "Tháng 7", "August" : "Tháng 8", "September" : "Tháng 9", "October" : "Tháng 10", "November" : "Tháng 11", "December" : "Tháng 12", "Jan." : "Tháng 1", "Feb." : "Tháng 2", "Mar." : "Tháng 3", "Apr." : "Tháng 4", "May." : "Tháng 5", "Jun." : "Tháng 6", "Jul." : "Tháng 7", "Aug." : "Tháng 8", "Sep." : "Tháng 9", "Oct." : "Tháng 10", "Nov." : "Tháng 11", "Dec." : "Tháng 12", "a safe home for all your data" : "Một ngôi nhà an toàn cho toàn bộ dữ liệu của bạn", "Application is not enabled" : "Ứng dụng không được BẬT", "Authentication error" : "Lỗi xác thực", "Token expired. Please reload page." : "Mã Token đã hết hạn. Hãy tải lại trang.", "PHP module %s not installed." : "PHP mô đun %s chưa được cài đặt", "Storage is temporarily not available" : "Kho lưu trữ tạm thời không khả dụng", "Text" : "Văn bản", "Summary" : "Tóm tắt", "Translate" : "Dịch", "Education Edition" : "Bản Giáo dục", "Users" : "Người dùng", "Open »%s«" : "Mở »%s«", "Click the button below to open it." : "Bấm vào nút bên dưới để mở nó." }, "nplurals=1; plural=0;"); eleting_metadata Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Memcache/CADTrait.php
blob: 3bf94246338f74f6fdd94367008ae8811822254c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/**
 * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
 * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
 * SPDX-License-Identifier: AGPL-3.0-only
 */
namespace OC\Memcache;

trait CADTrait {
	abstract public function get($key);

	abstract public function remove($key);

	abstract public function add($key, $value, $ttl = 0);

	/**
	 * Compare and delete
	 *
	 * @param string $key
	 * @param mixed $old
	 * @return bool
	 */
	public function cad($key, $old) {
		//no native cas, emulate with locking
		if ($this->add($key . '_lock', true)) {
			if ($this->get($key) === $old) {
				$this->remove($key);
				$this->remove($key . '_lock');
				return true;
			} else {
				$this->remove($key . '_lock');
				return false;
			}
		} else {
			return false;
		}
	}

	public function ncad(string $key, mixed $old): bool {
		//no native cad, emulate with locking
		if ($this->add($key . '_lock', true)) {
			$value = $this->get($key);
			if ($value !== null && $value !== $old) {
				$this->remove($key);
				$this->remove($key . '_lock');
				return true;
			} else {
				$this->remove($key . '_lock');
				return false;
			}
		} else {
			return false;
		}
	}
}