aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/WorkflowEngine/Events/LoadSettingsScriptsEvent.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2025-04-07 18:12:42 +0200
committerRobin Appelman <robin@icewind.nl>2025-04-07 19:35:41 +0200
commitc89e3c2f74d6f0bf253dddc18a4a4d305821cbe7 (patch)
tree77ae38024de782c713f8e0f9ff2a45f64f75b9d5 /lib/public/WorkflowEngine/Events/LoadSettingsScriptsEvent.php
parent084487bdd5ac052fc831509780ce2ffe5517eb41 (diff)
downloadnextcloud-server-files-cache-node.tar.gz
nextcloud-server-files-cache-node.zip
feat: move file cache to a background jobfiles-cache-node
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/public/WorkflowEngine/Events/LoadSettingsScriptsEvent.php')
0 files changed, 0 insertions, 0 deletions
hlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
<?php
/**
 * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
 * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

namespace Test\Cache;

/**
 * Class CappedMemoryCacheTest
 *
 * @package Test\Cache
 */
class CappedMemoryCacheTest extends TestCache {
	protected function setUp(): void {
		parent::setUp();
		$this->instance = new \OCP\Cache\CappedMemoryCache();
	}

	public function testSetOverCap(): void {
		$instance = new \OCP\Cache\CappedMemoryCache(3);

		$instance->set('1', 'a');
		$instance->set('2', 'b');
		$instance->set('3', 'c');
		$instance->set('4', 'd');
		$instance->set('5', 'e');

		$this->assertFalse($instance->hasKey('1'));
		$this->assertFalse($instance->hasKey('2'));
		$this->assertTrue($instance->hasKey('3'));
		$this->assertTrue($instance->hasKey('4'));
		$this->assertTrue($instance->hasKey('5'));
	}

	public function testClear(): void {
		$value = 'ipsum lorum';
		$this->instance->set('1_value1', $value);
		$this->instance->set('1_value2', $value);
		$this->instance->set('2_value1', $value);
		$this->instance->set('3_value1', $value);

		$this->assertTrue($this->instance->clear());
		$this->assertFalse($this->instance->hasKey('1_value1'));
		$this->assertFalse($this->instance->hasKey('1_value2'));
		$this->assertFalse($this->instance->hasKey('2_value1'));
		$this->assertFalse($this->instance->hasKey('3_value1'));
	}

	public function testIndirectSet(): void {
		$this->instance->set('array', []);

		$this->instance['array'][] = 'foo';

		$this->assertEquals(['foo'], $this->instance->get('array'));

		$this->instance['array']['bar'] = 'qwerty';

		$this->assertEquals(['foo', 'bar' => 'qwerty'], $this->instance->get('array'));
	}
}