Skip to content

Commit 7aa7111

Browse files
committed
Add Zstd implementation
Based on https://github.com/kjdev/php-ext-zstd
1 parent 7b59a10 commit 7aa7111

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php namespace com\mongodb\io;
2+
3+
class Zstd extends Compressor {
4+
public $id= 2;
5+
public $level;
6+
7+
/** @param int $level */
8+
public function __construct($level= -1) {
9+
$this->level= $level;
10+
}
11+
12+
public function compress($data) {
13+
return zstd_compress($data, $this->level);
14+
}
15+
16+
public function decompress($compressed) {
17+
return zstd_uncompress($compressed);
18+
}
19+
}

0 commit comments

Comments
 (0)