@@ -96,6 +96,41 @@ public function setHashAll($hashKey,$values = array()){
96
96
}
97
97
}
98
98
99
+ //hmset methodu kullanılarak belirtilen anahtara birçok değer tanımlanır.
100
+ //setHashAll fonksiyonundan farklı olarak array içerisinde array içeren değerler gönderilebilir.
101
+ public function setHashAllMultiArray ($ hashKey ,$ values = array ()){
102
+ /*
103
+ * Örnek Kullanım :
104
+ $redis->hmset($key, [
105
+ 0 =>[
106
+ 'age' => 44,
107
+ 'country' => 'finland',
108
+ 'occupation' => 'software engineer',
109
+ 'reknown' => 'linux kernel'
110
+ ],
111
+ 1 =>[
112
+ 'age' => 45,
113
+ 'country' => 'turkey',
114
+ 'occupation' => 'software engineer',
115
+ 'reknown' => 'linux kernel'
116
+ ],
117
+ ]);
118
+ */
119
+ //Array ile gelen data içerisinde kaç array daha barındırıyor bakılıyor.
120
+ $ boyut = count ($ values );
121
+ //Toplam boyut belirleniyor.
122
+ $ this ->setText ($ hashKey ."boyut " ,$ boyut );
123
+ $ i =0 ;
124
+ try {
125
+ foreach ($ values as $ key => $ value ) {
126
+ $ this ->setHashAll ($ hashKey .$ i ."tr " , $ value );
127
+ $ i ++;
128
+ }
129
+ } catch (Exception $ ex ) {
130
+ return "hata " ;
131
+ }
132
+ }
133
+
99
134
//hget methodunu kullanrak sadece belirtilen anahtara atanan tek değer alınır.
100
135
public function getHashSingle ($ hashKey ,$ key ){
101
136
/*
@@ -109,6 +144,21 @@ public function getHashSingle($hashKey,$key){
109
144
}
110
145
}
111
146
147
+ //hget methodunu kullanrak sadece belirtilen anahtara atanan tek değer alınır.
148
+ public function getHashFullMultiArray ($ hashKey ){
149
+ //Redis hafızasına alınan data boyutu
150
+ $ boyut = $ this ->getText ($ hashKey ."boyut " );
151
+ $ i = 0 ;
152
+ try {
153
+ for ($ i ;$ i <$ boyut ;$ i ++){
154
+ $ data [] = $ this ->redis ->hgetall ($ hashKey .$ i ."tr " );
155
+ }
156
+ return $ data ;
157
+ } catch (Exception $ ex ) {
158
+ return "hata " ;
159
+ }
160
+ }
161
+
112
162
//hget methodunu kullanrak sadece belirtilen anahtara atanan tek değer alınır.
113
163
public function getHashFull ($ hashKey ){
114
164
/*
0 commit comments