Memcached::prepend

(PECL memcached >= 0.1.0)

Memcached::prependPrepend data to an existing item

Beschreibung

public Memcached::prepend(string $key, string $value): bool

Memcached::prepend() prepends the given value string to the value of an existing item. The reason that value is forced to be a string is that prepending mixed types is not well-defined.

Hinweis:

If the Memcached::OPT_COMPRESSION is enabled, the operation will fail and a warning will be issued, because prepending compressed data to a value that is potentially already compressed is not possible.

Parameter-Liste

key

The key of the item to prepend the data to.

value

The string to prepend.

Rückgabewerte

Gibt bei Erfolg true zurück. Bei einem Fehler wird false zurückgegeben. The Memcached::getResultCode() will return Memcached::RES_NOTSTORED if the key does not exist.

Beispiele

Beispiel #1 Memcached::prepend() example

<?php
$m 
= new Memcached();
$m->addServer('localhost'11211);
$m->setOption(Memcached::OPT_COMPRESSIONfalse);

$m->set('foo''abc');
$m->prepend('foo''def');
var_dump($m->get('foo'));
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

string(6) "defabc"

Siehe auch

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

Was genau bedeutet "Vibe Coding"? Ein tiefgehender Blick für Entwickler

In der Welt der Softwareentwicklung gibt es unzählige Wege, wie man an ein Projekt herangeht. Manche schwören auf strikte Planung, andere auf bewährte Algorithmen und wieder andere lassen sich von etwas ganz anderem leiten: ihrem Gefühl. ...

admin

Autor : admin
Kategorie: Software & Web-Development

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

Slope rider

You need to be more attentive and have quicker reflexes with each run, as they become increasingly challenging and faster. Your slope rider (https ...

Geschrieben von NadiaEira am 06.01.2026 11:11:57
Forum: Ankündigungen
Slope rider

The wisdom I spent my entire thirties seeking for! red ball (https://red-ball4.com/)​ I only I had read it sooner! earn to die (https://earntodi ...

Geschrieben von sloperun am 05.01.2026 10:04:37
Forum: Ankündigungen
we become what we behold

henry stickmin (https://henrystickmin.io/)​ is a special stick figure. A passionate, lively, and energetic stick figure. we become what we behol ...

Geschrieben von sloperun am 05.01.2026 10:01:30
Forum: Ankündigungen
SEO-URLs und MySQL

Fast, fun, hilarious, and totally addictive! Once you start playing, it's hard to stop. Slope Run (https://sloperun2.io/)​ Join us today for end ...

Geschrieben von sloperun am 05.01.2026 09:58:07
Forum: SQL / Datenbanken